我正在使用下面的代码在Android Pager中加载图像,但是我得到一个空白区域而不是图像,当我加载文本时,我得到一个输出。无法在Android适配器中加载图像
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View vi=container;
//if(container==null)
vi = inflater.inflate(R.layout.fragment_pager_list, null);
TextView title = (TextView)vi.findViewById(R.id.textTitle); // title
ImageView thumb_image=(ImageView)vi.findViewById(R.id.imageProduct);
// thumb image
HashMap<String, String> song = new HashMap<String, String>();
song = ListProduct.productList.get(mNum);
// Setting all values in listview
title.setText(song.get(ListProduct.KEY_TITLE));
Bitmap bitmap = BitmapFactory.decodeFile
(song.get(ListProduct.KEY_THUMB_URL));
thumb_image.setImageBitmap(bitmap);
return vi;
}
上面的代码我使用但我没有得到我错的地方。请帮帮我。
如果从文件加载,检查文件是否存在于本地,尽量uotput的THUMB_URL控制台。 – Demonick 2013-04-24 11:26:48
请添加布局xml,并且ListProduct代码 – tbkn23 2013-04-24 11:32:44
ListProduct.KEY_THUMB_URL它是一个Url? (如http://www.site.com/img.jpg)?或一个资源到你的应用程序的Android? – VincentLamoute 2013-04-24 11:44:39