【问题标题】:Collapsing ExpandableListView GroupItem on button click within ChildItem在 ChildItem 内单击按钮时折叠 ExpandableListView GroupItem
【发布时间】:2016-07-29 05:41:42
【问题描述】:

是否可以通过在ChildItem 内单击按钮来折叠ExpandableListView 或ExpandableListAdapter 的GroupItem?

我想要实现的是:

我有一个ExpandableListView,它由ExpandableListAdapter 提供(扩展BaseExpandableListAdapter)

在ExpandableListAdapter 的getChildView() 方法中,我正在调用一个按钮(插入到子项布局xml 中),一旦用户完成阅读,我想使用该按钮关闭特定的GroupItem。

【问题讨论】:

    标签: android expandablelistview expandablelistadapter


    【解决方案1】:

    是的。在调用listView.collapseGroup(groupNumber)的按钮上设置一个onClickListener

    【讨论】:

    • 谢谢加布。这是我想要实现的目标,但我无法在我的 ExpandableListAdapter 的 getChildView() 方法中获取 ExpandableListView 实例。能否请您详细说明。
    • 在构造函数中传递给适配器,保存在成员变量中,然后就可以在任何地方使用了
    猜你喜欢
    • 1970-01-01
    • 2015-11-18
    • 1970-01-01
    • 2021-10-28
    • 2012-11-30
    • 2019-08-26
    • 2023-03-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多