I want to paint a Nine Patch into a Bitmap (filling all the space with the fill space). Thats my code but doesn’t work. Can you help me?
Bitmap bmp= Bitmap.createBitmap(300, 300, Bitmap.Config.ARGB_8888);
Drawable drawable= getResources().getDrawable(R.drawable.car);
Canvas canvas= new Canvas(bmp);
drawable.draw(canvas);
iv2.setImageBitmap(bmp);
Try setting the bounds of your drawable before drawing:
Although given that it looks like you’re just using an
ImageView, I’m not sure why you’re not just setting it directly usingsetImageDrawable.