簡體   English   中英

如何在Android中制作ExpandableListView始終顯示子項

[英]How to make an ExpandableListView in Android always show child items

我想制作一個ExpandableListView ,即使單擊標題后也應該始終顯示其子元素,並且它不應該折疊。 我如何實施這個概念?

您可以按照這篇文章中的說明,按如下所示逐個展開所有組

ExpandableListView explst;

explst.expandGroup(0);
explst.expandGroup(1);

禁用崩潰,你可以定義一個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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM