android ExpandableListView 如何给child 添加单击事件
1个回答
展开全部
1.获得控件
ExpandableListView mListView = (ExpandableListView) findViewById(R.id.X);
2.添加childOnclick监听
mListView.setOnChildClickListener(childListener);
OnChildClickListener childListener = new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
}
};
ExpandableListView mListView = (ExpandableListView) findViewById(R.id.X);
2.添加childOnclick监听
mListView.setOnChildClickListener(childListener);
OnChildClickListener childListener = new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
}
};
追问
我是这样写的触发不了?
追答
BaseExpandableListAdapter 中注意下这一项
/**
* 子集是否可选
*/
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询