Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bad 'Patches' in 9-Patch File

I'm attempting to use the Draw9Patch tool from the Android SDK, but immediately upon opening my image with Draw9Patch it shows all of my image area as a 'Bad Patch.' I manually drew in the lines that define the stretchable areas, however I am unsure if this will work properly. Could someone explain why this specific image is not a 'good patch'? Other Stackoverflow answers to this question do not seem to correlate to my problem or I am not understanding them.

Example of Draw9Patch Bad PatchesOriginal Image

like image 328
Nick Betcher Avatar asked Sep 15 '11 06:09

Nick Betcher


People also ask

What is a 9 patch file?

The Draw 9-patch tool is a WYSIWYG editor included in Android Studio that allows you to create bitmap images that automatically resize to accommodate the contents of the view and the size of the screen. Selected parts of the image are scaled horizontally or vertically based on indicators drawn within the image.

What is a 9 patch image?

A 9 patch image is a regular png (. PNG) image which is needful for android app developers where they require to wrap any content within a background image without pixelating the background image.


1 Answers

Old, but I had the same question. The "bad patch" thing is definitely confusing, but won't stop your drawable from working. The dev sites says it's basically a warning that those patch sites "may produce artifacts in the graphic when stretched"‌​.

If you look at a lot of the stock Android drawables you'll see that they contain "bad patches". So just test them out and if they look fine I wouldn't worry about it.

like image 141
Tony Chan Avatar answered Sep 23 '22 05:09

Tony Chan