[英]How to make an ExpandableListView in Android always show child items
I want to make an ExpandableListView
which should always be showing its children elements even after clicking the header, and it should not collapse. 我想制作一个ExpandableListView
,即使单击标题后也应该始终显示其子元素,并且它不应该折叠。 How could I implement this concept? 我如何实施这个概念?
you can expand all groups one by one as below as mentioned in this post 您可以按照这篇文章中的说明,按如下所示逐个展开所有组
ExpandableListView explst;
explst.expandGroup(0);
explst.expandGroup(1);
for disabling collapse you can define a OnGroupClickListener which returns true, like so: (as mentioned in this post) 禁用崩溃,你可以定义一个OnGroupClickListener返回true,像这样:(因为在提到这个岗位)
explst.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
return true; // This way the expander cannot be collapsed
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.