Bitmap bitmap=BitmapFactory.decodeResource(context.getResources(),R.drawable.feedback_content_header_bg); //取得资源 NinePatch npd=new NinePatch(bitmap,bitmap.getNinePatchChunk(),null); npd.draw(canvas,new Rect(0,0,canvas.getWidth(),canvas.getHeight()));