2017-05-07 46 views
0

我試圖將圖像下載到片段中的圖像視圖中,但它在圖像視圖中不顯示任何圖像,甚至沒有佔位符和錯誤圖像。我的代碼片段如下畢加索沒有在片段中顯示佔位符,錯誤和URL圖像

@Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
          Bundle savedInstanceState) { 



     View view = inflater.inflate(R.layout.fragment_one, container, false); 
     ImageView imageView = (ImageView) view.findViewById(R.id.imageView); 
     Context c = getActivity().getApplicationContext(); 
     Picasso.with(c) 
       .load("http://inthecheesefactory.com/uploads/source/glidepicasso/cover.jpg"). 
     placeholder(R.drawable.aa).error(R.drawable.ab) 
       .into(imageView); 

     return inflater.inflate(R.layout.fragment_one, container, false); 
    } 

當我嘗試在正常活動中使用相同的代碼一切正常。這個問題只會出現在片段活動中。我在材質設計的滑動視圖中使用了imageview。

回答

0

你可以試試這個, 而不是此

 return inflater.inflate(R.layout.fragment_one, container, false); 

嘗試

  return view; 
+0

感謝的人。它的工作 –

+0

高興地幫助@ sagar.acharya – wonderPub

相關問題