【问题标题】:expandablelistview disappear when group collapse组折叠时可展开列表视图消失
【发布时间】:2013-08-12 07:50:11
【问题描述】:

我正在尝试在我的 android 应用程序中使用 expandablelistview,问题是当我单击 EXPANDED 组时,整个 expandablelistview 消失了,有人遇到同样的问题并且知道如何解决吗?

我的 getChildrenCount 和 getGroupCount 方法:

      @Override
    public int getChildrenCount(int groupPosition) {
        // TODO Auto-generated method stub
        return 1;
    }

    @Override
    public int getGroupCount() {

        return super.getGroupCount();
    }

【问题讨论】:

  • 你实现getGroupCount和getChildrenCount方法了吗?听起来计数已更改为 0,因此您的整个列表不包含任何项目-> 它消失了。

标签: java android expandablelistview


【解决方案1】:

我通过覆盖其中的 onColpse() 方法和 notifyDataSetInvalidated() 来做到这一点:

    @Override
    public void onGroupCollapsed(int groupPosition) {

        notifyDataSetInvalidated();

    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-20
    • 2011-03-06
    • 2011-05-31
    • 2016-11-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多