我想从gridview中选择图像的属性。例如,如果我正在使用。
GridView gridview = (GridView) findViewById(R.id.imageGallery);
gridview.setAdapter(new ImageAdapter(this));
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position,long id)
{
//need code in here that I can do something like this.
//Get access to the integer value of the R.drawable.myimage
//use that int too do a lookup in a dictionary to check for existance
//can't see to find any code to get at the drawable associated with the image clicked in the grid, did intense debug
数据在运行时不易显示
}
);
答案 0 :(得分:0)
@Reid我想你会想要根据列表中的位置创建一个自定义适配器(扩展BaseAdapter或其他),它包含一个包含你需要获取的元数据的视图类。可能是一种更简单的方法,但这就是我在ListView中所做的。几个链接:
http://developer.android.com/resources/tutorials/views/hello-gridview.html http://www.anddev.org/gridview-t5585.html