Expandable list view move group icon indicator to right

前端 未结 16 2426
栀梦
栀梦 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条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 09:43

    Write this code in Expandable Base adapter.

    @Override
    public View getGroupView(int groupPosition, boolean isExpanded,
                             View convertView, ViewGroup parent) {
        ImageView imgs;
    
        String headerTitle = (String) getGroup(groupPosition);
        if (convertView == null) {
            LayoutInflater infalInflater = (LayoutInflater) this._context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = infalInflater.inflate(R.layout.list_group, null);
        }
    
        TextView lblListHeader = (TextView) convertView
                .findViewById(R.id.lblListHeader);
         imgs = (ImageView) convertView
                .findViewById(R.id.img_list);
        lblListHeader.setTypeface(null, Typeface.BOLD);
        lblListHeader.setText(headerTitle);
        if (isExpanded) {
      imgs.setImageResource(R.drawable.up_arrow);
        }
        else {
            imgs.setImageResource(R.drawable.downs_arrow);
        }
    
        return convertView;
    }
    
    • List item

提交回复
热议问题