我有一个ExpandableListView
,我不知道为什么当我点击一个孩子时我的听众从未被调用过。这是我的代码:
public class MainActivity extends ExpandableListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// ...
this.getExpandableListView().setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
Log.v("test", "short");
// not working when I click on a child
}
});
this.getExpandableListView().setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
Log.v("test", "long");
// not working when I click on a child
return true;
}
});
}
}