public void setForeground ( Drawable drawable ) { if ( mForeground != drawable ) { if ( mForeground != null ) { mForeground . setCallback ( null ) ; unscheduleDrawable ( mForeground ) ; } mForeground = drawable ; if ( drawable != null ) { setWillNotDraw ( false ) ; drawable . setCallback ( this ) ; if ( drawable . isStateful ( ) ) { drawable . setState ( getDrawableState ( ) ) ; } if ( mForegroundGravity == Gravity . FILL ) { Rect padding = new Rect ( ) ; drawable . getPadding ( padding ) ; } } else { setWillNotDraw ( true ) ; } requestLayout ( ) ; invalidate ( ) ; } }
Supply a Drawable that is to be rendered on top of all of the child views in the frame layout . Any padding in the Drawable will be taken into account by ensuring that the children are inset to be placed inside of the padding area .