我正在使用自定义可扩展列表视图,并且适配器不在我的活动范围内。在我的活动中,我可以很好地设置 onclicklistener
mTopicsExpandListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Log.i("MEAT", "This child row was clicked!");
return false;
}
});
但是为了避免需要使用静态变量,在不久的将来,我希望能够在适配器本身中使用实现 OnChildClickListener
public class MExpandableListAdapter extends BaseExpandableListAdapter implements OnChildClickListener {
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Log.i("MEAT", "This child row was clicked!");
return false;
}
但后者什么也不做。第二种情况有什么不同吗?IsChildSelectable 设置为 true