android ninepatchdrawable可缩放

【android ninepatchdrawable可缩放】欠伸展肢体,吟咏心自愉。这篇文章主要讲述android ninepatchdrawable可缩放相关的知识,希望能为你提供帮助。

  1. NinePatchDrawable drawable = ( NinePatchDrawable) context.getResources( ) .getDrawable( R.drawable.btn_default_normal) ;
  2. paint.setColor( Color.BLUE) ;
  3. int width = ( int) this.mRect.width( ) ;
  4. int height = ( int) this.mRect.height( ) ;
  5. drawable.setBounds( new Rect( 0, 0, width,height) ) ;
  6. Bitmap b = Bitmap.createBitmap( width, height, Config.ARGB_8888) ;
  7. Canvas c = new Canvas( b) ;
  8. drawable.draw( c) ;
  9. canvas.drawBitmap( b, new Rect( 0, 0, width, height) , rect, paint) ;


    推荐阅读