How to check if group is expanded or collapsed in Android ExpandableListView?

前端 未结 4 2474
感动是毒
感动是毒 2021-02-20 04:13

I\'m looking for an api like isExpanded() or isCollapsed() that tell me if a group is expanded or collapsed.

4条回答
  •  情深已故
    2021-02-20 04:32

    There is a parameter in getGroupView() on your ExpandableListAdapter, a boolean that represents wheter the group is expanded or not.

    From (http://developer.android.com/reference/android/widget/ExpandableListAdapter.html#getGroupView(int, boolean, android.view.View, android.view.ViewGroup)

    Gets a View that displays the given group. This View is only for the group--the Views for the group's children will be fetched using getChildView(int, int, boolean, View, ViewGroup)).

    Parameters

    groupPosition the position of the group for which the View is returned

    isExpanded whether the group is expanded or collapsed

    convertView the old view to reuse, if possible. You should check that this view is non-null and of an appropriate type before using. If it is not possible to convert this view to display the correct data, this method can create a new view. It is not guaranteed that the convertView will have been previously created by getGroupView(int, boolean, View, ViewGroup). parent the parent that this view will eventually be attached to

提交回复
热议问题