本文介绍了如何禁用ExpandableListView的塌陷?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现一个 ExpandableListView 这应该是扩展后,才所有的值被设置在适配器内。此外,我希望能够禁用扩展的溃散。

I would like to implement a ExpandableListView which should be expandable only after all the values have been set up within the adapter. Also I would like to be able to disable the collapsing of the expander.

我能做到这一点在Android XML布局中?

Can I achieve this within an Android XML Layout?

问候,
一个Jabeer阿里

Regards,
A Jabeer Ali

推荐答案

您可以定义一个 OnGroupClickListener 返回,像这样:

You can define a OnGroupClickListener which returns true, like so:

expandableList.setOnGroupClickListener(new OnGroupClickListener() {
  @Override
  public boolean onGroupClick(ExpandableListView parent, View v,
                              int groupPosition, long id) { 
    return true; // This way the expander cannot be collapsed
  }
});

这篇关于如何禁用ExpandableListView的塌陷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 21:24