Change ImageView in a GridView Programmatically

前端 未结 2 570
孤街浪徒
孤街浪徒 2021-01-15 20:25

I\'ve set up a grid of ImageViews with TextView overlays. My ImageAdapter code is as follows:

    public View getView(int position, View convertView, ViewGro         


        
2条回答
  •  隐瞒了意图╮
    2021-01-15 20:55

    You can set a unique id to each ImageView using names (See here) or even integer numbers with a sequence or something (increasing at each image you put in the view).

    Another good way to do this is using the tags, with setTag() and getTag(). This question has a good answer: What is the main purpose of setTag() getTag() methods of View?

提交回复
热议问题