android ListView中添加ImageButton按钮并绑定事件

1.首先继承BaseAdapter
2.复写getView()方法
3.给对应imageButton绑定监听事件
4.在每项的xml里的imageButton中添加android:focusable="false" android:focusableInTouchMode="false"
5.在ImageButton的上级Layout中添加android:descendantFocusability="blocksDescendants"
注:4、5两部必须做 不然ListView的OnItemClick方法会失效

猜你喜欢

转载自allen-shen.iteye.com/blog/1743808