Expandable list view move group icon indicator to right

前端 未结 16 2459
栀梦
栀梦 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:46

    i know it's too late but here is a solution to put the indicator on the right programmatically, simple and easy to use :

    expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
    
            Display display = getWindowManager().getDefaultDisplay();
            Point size = new Point();
            display.getSize(size);
            int width = size.x;
            Resources r = getResources();
            int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                    50, r.getDisplayMetrics());
            if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
                expandableListView.setIndicatorBounds(width - px, width);
            } else {
                expandableListView.setIndicatorBoundsRelative(width - px, width);
            }
    

    where expandableListView is your ExpandableListview

提交回复
热议问题