Code example for ShapeDrawable

Methods: setBounds, draw, getPaint

0
	{ 
		super.onDraw(canvas);
		 
		//½«Í¼Æ¬²Ã¼ôΪÍÖÔ²ÐΠ
		/* ¹¹½¨ShapeDrawable¶ÔÏ󲢶¨ÒåÐÎ״ΪÍÖÔ² */ 
		mShapeDrawableQQ = new ShapeDrawable(new OvalShape());
 
		/* ÉèÖÃÒª»æÖƵÄÍÖÔ²ÐεĶ«Î÷ΪShapeDrawableͼƬ */ 
		mShapeDrawableQQ.getPaint().setShader(mBitmapShader);
		 
		/* ÉèÖÃÏÔʾÇøÓò */ 
		mShapeDrawableQQ.setBounds(0,0, BitQQwidth, BitQQheight);
		 
		/* »æÖÆShapeDrawableQQ */ 
		mShapeDrawableQQ.draw(canvas); 		
		 
		//»æÖƽ¥±äµÄ¾ØÐΠ
		mPaint.setShader(mLinearGradient);
		canvas.drawRect(BitQQwidth, 0, 320, 156, mPaint);
	 
		//ÏÔʾ»ìºÏäÖȾЧ¹û