Code example for ExpandableListView

Methods: setIndicatorBounds

0
        /* Get the screen width */ 
        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);
        int width = dm.widthPixels;
  
        expListView.setIndicatorBounds(width - getDipsFromPixel(60), width
                - getDipsFromPixel(5)); 
    } 
  
    // Convert pixel to dip 
    public int getDipsFromPixel(float pixels) {
        // Get the screen's density scale 
        final float scale = getResources().getDisplayMetrics().density;
        // Convert the dps to pixels, based on density scale 
        return (int) (pixels * scale + 0.5f);
    } 
  
}