Code example for ExpandableListView

Methods: setIndicatorBounds

0
 
    private void setGroupIndicatorToRight() { 
        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);
        int width = dm.widthPixels;
        expListView.setIndicatorBounds(width - pixelsToDips(35), width - pixelsToDips(5));
    } 
 
    public int pixelsToDips(float pixels) {
        final float scale = getResources().getDisplayMetrics().density;
        return (int) (pixels * scale + 0.5f);
    } 
 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main_menu, menu);
        return true; 
    } 
 
}