9-patch drawable behaving badly, weird artefacts - what is wrong here?

后端 未结 3 1200
天涯浪人
天涯浪人 2021-01-15 08:21

so Im trying out the 9-patch images. I started out with a PNG-file where I have a semi-transparent square with rounded corners:

相关标签:
3条回答
  • 2021-01-15 08:36

    Try to do 9-patch markings from all 4 sides. Also make sure you have .9.png file extension (f.i. your_cool_pic.9.png)

    Here is my example enter image description here

    0 讨论(0)
  • 2021-01-15 08:41

    Make it small as possible. 9-patch cant shrink they can stretch. Fill right and bottom border with black color. Edit 9-patch borders with draw9patch tool to prevent errors. Your 9-patch should look similar to this one.

    0 讨论(0)
  • 2021-01-15 08:50

    The 1 pixel border must be either completely black (nine patch markers) or completely transparent. Basically, edit the image to cut out anything in the 1 pixel border except for the two black dots.

    Also, your image can be much, much smaller in size. The point of a nine patch is that the markers on the top and left sides mark what is to be stretched. Most of that content with straight edges could be removed.

    0 讨论(0)
提交回复
热议问题