Code example for LayerDrawable

Methods: setBounds, draw, setAlpha

0
    Rect rect = new Rect();
    @Override 
    protected synchronized void onDraw(Canvas canvas) {
        //super.onDraw(canvas); 
        rect = getBackground().getBounds();
        mThumb.setBounds(rect);
		//Log.d(TAG, "mThumb bounds="+rect); 
		//Log.d(TAG, "onDraw() called"); 
		//canvas.getClipBounds(rect); 
		//Log.d(TAG, "canvas bounds="+rect+","+(int) (mPressure * 10000)); 
		//Log.d(TAG, "ColorFilter="+(int) (mPressure * 10000)); 
		//int alpha=(int) (mPressure * 3*255); 
		//Log.d(TAG, "Alpha="+alpha); 
		 
		//mPaint.setAlpha(alpha); 
		//canvas.drawCircle(mTouchDownX, mTouchDownY, 18.0f * mPressure * 10, mPaint); 
		mThumb.setAlpha((int) (mPressure * 3 * 255) +20);
    	//mThumb.setColorFilter((0xFF000000 +(int) (mPressure * 10000)), PorterDuff.Mode.MULTIPLY); 
        this.mThumb.draw(canvas);
    } 
 
}