【发布时间】:2017-10-05 06:48:21
【问题描述】:
我正在尝试将图像下载到片段中的图像视图中,但它在图像视图中不显示任何图像,甚至不显示占位符和错误图像。我的代码片段如下
@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);
}
当我尝试在正常活动中使用相同的代码时,一切正常。问题只出现在片段活动中。我在 Material Design 的滑动视图中使用 imageview。
【问题讨论】:
标签: android android-fragments picasso