0

嗨,谁能告诉我如何设置和获取 GridView 中图像的标签。提前谢谢各位小伙伴。我已经编写了以下代码,但它不起作用?这是正确的吗?

int jj=100;
    for(int j=0;j<ia.imageid.length;i++)
        {

        g.getChildAt(j).setTag(jj);
        jj++;
        }
4

1 回答 1

0

在适配器的getView..

public View getView(int position, View convertView, ViewGroup parent) {
   View view;
   if(convertView == null) {
      view = inflater.inflate(R.layout.image, null);
   }
   else
      view = convertView;

   ImageView image = (ImageView)view.findViewById(R.id.image);
   image.setTag();
}
于 2012-12-19T12:08:37.680 回答