I\'m trying to draw a nine patch onto a Canvas object on the Android. What seems strange is that although I generated my nine patch using the draw9patch tool, the constructor fo
You can easily do it this way:
// Load the image as a NinePatch drawable
NinePatchDrawable npd = (NinePatchDrawable)Resources.getDrawable(R.drawable.my_nine_patch);
// Set its bound where you need
Rect npdBounds = new Rect(...);
npd.setBounds(npbBounds);
// Finally draw on the canvas
npd.draw(canvas);