![](/img/trans.png)
[英]How to make child in ExpandableListView a textbox instead of a list for Android?
[英]Android: How to make child rows in ExpandableListView non-cklickable?
猜猜这很简单,但是搜索没有帮助...
我想要一个ExpandableListView,在其中您不能选择子行。
我试图将选择器设置为“透明”,但它仍然更改了文本颜色,因此您会注意到已单击。
亲切的问候,水母
如果您来不及,但希望对您有所帮助。
您必须在适配器中实现此方法:
public class MyExpandableAdapter extends BaseExpandableListAdapter {
@Override
public boolean isChildSelectable(int arg0, int arg1) {
// Al childs items, If you want some active items have to specify their indices and return true or false
return false;
}
// With all other methods
...
}
您是否尝试在子视图上添加setFocusable(false)参数? 还将文本颜色更改为黑色。 默认情况下有一个选择器,黑色时默认为白色。 因此基本上将子视图的每种颜色更改为不可选择的颜色。
我意识到,在大多数Android应用程序(例如,我自己手机上的设置)中,即使事后没有任何动作,显然也没有人愿意关掉“ click”动画。 因此,我决定也就这样离开。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.