Expandable list view move group icon indicator to right

前端 未结 16 2439
栀梦
栀梦 2020-12-04 08:56

As regards to expandable list view, the group icon indicator is positioned to the left side, can I move the indicator and positioned it to the right? Thanks.

16条回答
  •  Happy的楠姐
    2020-12-04 09:45

    First set android:groupIndicator="@null" in you Expandable listview as below:

    then in your header layout as below:

    
    
    
    
    
        
    
    
        
    
    
    

    Lastly add this in you adapter in getGroupView method add below :

    TextView lblListHeader = (TextView) convertView.findViewById(R.id.tvQuestion);
    
    lblListHeader.setText(headerTitle);
    
    ImageView img=convertView.findViewById(R.id.imgDropDown);
    
    if (isExpanded) {
      img.setImageResource(R.drawable.down_arrow);
        lblListHeader.setTextColor(_context.getResources().getColor(R.color.colorPrimary));
    } else {
     img.setImageResource(R.drawable.right_arrow);
        lblListHeader.setTextColor(_context.getResources().getColor(R.color.textColor));
    }
    

提交回复
热议问题