2017-05-07 74 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