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

前端 未结 4 2450
感动是毒
感动是毒 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:47

    You can use isGroupExpanded .

     expListViewObj.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
    
                    @Override
                    public boolean onGroupClick(ExpandableListView parent, View v,
                                                int groupPosition, long id) {
    
                        if(parent.isGroupExpanded(groupPosition))
                        {
    
                         // Do your Staff
                        }
                        else{
    
                           // Expanded ,Do your Staff
    
                        }
    
    
                        return false;
                    }
                });
    

    For more details you can visit Here

    http://developer.android.com/reference/android/widget/ExpandableListView.html#setOnGroupClickListener(android.widget.ExpandableListView.OnGroupClickListener)

提交回复
热议问题