gpt4 book ai didi

android - 为 ExpandableListView 设置 onChildClickListener 时出现问题

转载 作者:搜寻专家 更新时间:2023-11-01 08:14:05 24 4
gpt4 key购买 nike

我在使可扩展 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com