开发者

SimpleAdapter including a button. Java, Android

开发者 https://www.devze.com 2023-03-06 15:50 出处:网络
first time asking - hope you can help. I\'ve created a SimpleAdapter, and an ArrayList/HashMap which maps to a Layout containing an ImageView & 2 TextViews. When the SimpleAdapter is assigned to

first time asking - hope you can help.

I've created a SimpleAdapter, and an ArrayList/HashMap which maps to a Layout containing an ImageView & 2 TextViews. When the SimpleAdapter is assigned to my ListView it all works exactly as expected. My problem is this - I want to add an ImageButton to the Layout used by the SimpleAdapter and cant work out how to do this. I added t开发者_开发知识库he ImageButton to the Layout, and I think I have to create a corresponding ImageButton for each HashMap I add to the ArrayList, but its not doing what I thought. How do I hookup an OnClickListener & how do I reference this back to the ListView index of the item the button was clicked for ?

Hope this explanation makes sense, any code examples would be most helpful. Thanks, daveD


I think that the best option would be to use a custom adapter.

0

精彩评论

暂无评论...
验证码 换一张
取 消