Highlight for selected item in expandable list

后端 未结 11 2103
攒了一身酷
攒了一身酷 2021-01-31 21:25

I have a layout where I have an expandable list in a fragment on the left and a details fragment on the right. This all works fine.

Now I would like to indicate what

11条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-31 21:39

    In case you need only the child item color to be changed than in the onchildclick method set the background color to the View v.

    @Override
                public boolean onChildClick(ExpandableListView parent, View v,
                        int groupPosition, int childPosition, long id) {
                    // TODO Auto-generated method stub
                    v.setBackgroundColor(Color.RED);
    }
    

    to do so set isChildSelectable to true in the adapter.

提交回复
热议问题