Code example for Paint

Methods: setColorsetMaskFiltersetStyle

0
 * This custom layout paints a drop shadow behind all children. The size and opacity 
 * of the drop shadow is determined by a "depth" factor that can be set and animated. 
 */ 
public class ShadowLayout extends RelativeLayout {
 
    Paint mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    float mShadowDepth;
    Bitmap mShadowBitmap;
    static final int BLUR_RADIUS = 6;
    static final RectF sShadowRectF = new RectF(0, 0, 200, 200);
    static final Rect sShadowRect = new Rect(0, 0, 200 + 2 * BLUR_RADIUS, 200 + 2 * BLUR_RADIUS);
    static RectF tempShadowRectF = new RectF(0, 0, 0, 0);
     
    public ShadowLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(); 
    } 
 
    public ShadowLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(); 
    } 
 
    public ShadowLayout(Context context) {
        super(context);
        init(); 
    } 
     
    /** 
     * Called by the constructors - sets up the drawing parameters for the drop shadow. 
     */ 
    private void init() { 
        mShadowPaint.setColor(Color.BLACK);
        mShadowPaint.setStyle(Style.FILL);
        setWillNotDraw(false);
        mShadowBitmap = Bitmap.createBitmap(sShadowRect.width(),
                sShadowRect.height(), Bitmap.Config.ARGB_8888);
        Canvas c = new Canvas(mShadowBitmap);
        mShadowPaint.setMaskFilter(new BlurMaskFilter(BLUR_RADIUS, Blur.NORMAL));
        c.translate(BLUR_RADIUS, BLUR_RADIUS);
        c.drawRoundRect(sShadowRectF, sShadowRectF.width() / 40,
                sShadowRectF.height() / 40, mShadowPaint);
    } 
     
Connect your IDE to all the code out there  Get Codota for Java