我Listview 的每个Item很长,每个item中有若干个标签,标签可以点击折叠和关闭
比如现在有两个item,当前显示第一个item position为0,点击item内的便签都正常
,当getView返回的position是1时,第二个item只显示一点点,但是操作第一个item的点击事件
都在第二个item中有反应,请问这是为什么(ps:取消复用机制也没作用)
ListView点击事件错乱
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答 默认 最新
HoukHan 2019-03-05 14:11关注你是否使用了ExpandableListView 如果使用了尝试自己设置下高度
public class MyExpanableListView extends ExpandableListView { public MyExpanableListView(Context context) { super(context); } public MyExpanableListView(Context context, AttributeSet attrs) { super(context, attrs); } public MyExpanableListView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { //重新设置高度 heightMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, heightMeasureSpec); } }解决 无用评论 打赏 举报