2011-03-28 56 views

回答

1

步骤1)从文件创建的位图绘制:

BitmapDrawable d = BitmapDrawable.createFromPath("path"); 

步骤2)设定于相应的网格物品的图像视图此可绘制。

ImageView iv = new ImageView(this); 
iv.setImageDrawable(drawable); 

如何设置网格视图imageview的,请参考以下链接:

http://developer.android.com/guide/tutorials/views/hello-gridview.html

+0

@mudit,感谢您对我试过的响应,但模拟器显示什么我的代码is' BitmapDrawable d =(BitmapDrawable)BitmapDrawable.createFromPath(“/ data/data/com.dynamicView/XmlFiles/img.jpg”); imageview.setImageDrawable(d);' – Kishore 2011-03-28 10:21:19

+0

在这里删除一些代码..可能是你在代码中做了一些错误.. – mudit 2011-03-28 10:27:41

+0

@mudi这是代码:BitmapDrawable d =(BitmapDrawable)BitmapDrawable.createFromPath(“/ data/data /com.dynamic/XmlFiles/img.jpg“); \t \t private Context mContext; public Source(Context c){mContext = c; } public int getCount(){return mThumbIds.length; } public Object getItem(int position){return null; } public long getItemId(int position){return 0; } public view getView(int position,View convertView,ViewGroup parent){ – Kishore 2011-03-28 10:35:11

相关问题