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

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

    If u use BaseExpandableListAdapter class you have getGroupView() override method.

    public View getGroupView(int i, boolean b, View view, ViewGroup viewGroup) {
    
        // Here is your expand list view parent id
        // b specify that parent expand or not.
    
        .............
    
        if(b){
            imdDownArrow.setVisibility(View.GONE);
            imdUpArrow.setVisibility(View.VISIBLE);
        }else{
            imdDownArrow.setVisibility(View.VISIBLE);
            imdUpArrow.setVisibility(View.GONE);
        }
        ...............
        return view;
    }
    

    so using this simple code you can show arrow up or down

提交回复
热议问题