Android Expandable Listview customization on child view

后端 未结 2 1127
慢半拍i
慢半拍i 2021-01-28 16:11

i want to implement expandable list view with multiple child layouts. all works fine but problem om,child view..child not appear on appropriate position.... here is my code...PL

2条回答
  •  北恋
    北恋 (楼主)
    2021-01-28 16:29

    BaseExpandableListAdapter doesn't have getViewTypeCount() and getItemViewType(). in order to have different children view types you have to override the following methods instead.

    @Override
    public int getChildTypeCount() {
        return 2;
    }
    
    @Override
    public int getChildType(int groupPosition, int childPosition) {
    if (getChildId(groupposition, childposition)==3) 
            return 0;
    
        //Not free
        else 
            return 1;
    }
    

提交回复
热议问题