public void setDrawable ( int index , Drawable drawable ) { if ( index >= mLayerState . mNum ) { throw new IndexOutOfBoundsException ( ) ; } final ChildDrawable [ ] layers = mLayerState . mChildren ; final ChildDrawable childDrawable = layers [ index ] ; if ( childDrawable . mDrawable != null ) { if ( drawable != null ) { final Rect bounds = childDrawable . mDrawable . getBounds ( ) ; drawable . setBounds ( bounds ) ; } childDrawable . mDrawable . setCallback ( null ) ; } if ( drawable != null ) { drawable . setCallback ( this ) ; } childDrawable . mDrawable = drawable ; mLayerState . invalidateCache ( ) ; refreshChildPadding ( index , childDrawable ) ; }
Sets the drawable for the layer at the specified index .