我在让可扩展 ListView 的点击监听器正常工作时遇到问题。我是否正确执行了此操作?
代码:
elv = getExpandableListView();
// Set up the adapter
mAdapter = new MyExpandableListAdapter();
elv.setAdapter(mAdapter);
elv.setOnChildClickListener(new OnChildClickListener() {
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Toast.makeText(getApplicationContext(), "click", Toast.LENGTH_SHORT);
v.setBackgroundColor(0x000000);
return false;
}
});
最佳答案
您尚未在 Toast 消息中调用 show()。因此,如果您确定它是否仅适用于 Toast 消息,那么它似乎不起作用。添加.show();在创建 toast 的行的末尾,它应该显示
关于android - 为 ExpandableListView 设置 onChildClickListener 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6496559/