public double [ ] getDerivedDimensions ( ) { Double width = getWidth ( ) ; Double height = getHeight ( ) ; if ( width == null || height == null ) { BitmapFactory . Options options = getDataBounds ( ) ; int dataWidth = options . outWidth ; int dataHeight = options . outHeight ; if ( width == null ) { width = ( double ) dataWidth ; if ( height != null ) { width *= ( height / dataHeight ) ; } } if ( height == null ) { height = ( double ) dataHeight ; if ( width != null ) { height *= ( width / dataWidth ) ; } } } return new double [ ] { width , height } ; }
Get the derived width and height from the values and icon data scaled as needed