I'm trying to draw a NinePatchDrawable to a canvas,
but all what i get is a stretched normal drawable:
NinePatchDrawable test = (NinePatchDrawable)getResources().getDrawable(R.drawable.test_orig);
Rect tbounds = new Rect(10, 10, 310, 110);
test.setBounds(tbounds);
test.draw(canvas);
original nine patch:
what it is supposed to look like:
what i get:
and before you ask:
yes, I have named the image test_orig.9.png
and it is in the right folder.
Remove the lines at the right and the bottom, only keep the top and the left of your current 9-patch image. That should work, hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.