【发布时间】:2012-12-11 15:42:32
【问题描述】:
我有一个 Android 自定义列表视图适配器,
我需要将一些图像流式传输/加载到我的自定义行布局/ImageView 中。
所以我尝试了:
myImageView.setImageBitmap(BitmapFactory.decodeFile(o.getIcon_url()));
喜欢下面的这段代码。
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.row_applications, null);
}
ApplicationsModel o = items.get(position);
if (o != null) {
ImageView tv_icon = (ImageView) v.findViewById(R.id.iv_icon);
if(row_icon !=null)
{
tv_icon.setImageBitmap(BitmapFactory.decodeFile(o.getIcon_url()));
}
}
return v;
}
但图像无法在我的自定义列表视图中阅读。
该代码适用于 TextView 的..
【问题讨论】:
标签: android imageview adapter bitmapfactory