Could anyone help me with creating 9 patch image from a png image?

后端 未结 4 1695
孤街浪徒
孤街浪徒 2021-01-03 02:26

I am creating a chat application.I want the to convert my png image for chat bubble into a 9patch image.I used this link.... http://android-ui-utils.googlecode.com/hg/asset-

相关标签:
4条回答
  • 2021-01-03 02:41
    • There is a tool distributed along with the SDK called draw9patch. It should be already there in your SDK folder. Check <sdk-directory>/tools/draw9patch. This tool is easy to use and quite intuitive. Learn more about draw9patch here.

    enter image description here

    • On the other hand, you can use the Android Asset Studio cloud app here.
    0 讨论(0)
  • 2021-01-03 02:42

    Try the http://draw9patch.com/

    Or you can use the sample app from here

    http://warting.github.io/AndroidChatBubbles/

    0 讨论(0)
  • 2021-01-03 02:49

    Actually it was a problem with the image i used for my app.The image i used was bigger in width.For 9patch images to work properly,the width should be minimum.I used another image of smaller width instead of this and bam !!! it worked perfectly :)

    0 讨论(0)
  • 2021-01-03 02:51

    Your 9-patch image needs to be smaller than your smallest message. The system will expand 9-patch images, but will never shrink them in the 9-patch way. Also, make sure the name of your image file ends in ".9.png".

    Here's an edited image that you can use in the Android Asset Tool to create your set of 9-patch images:

    enter image description here

    The following image shows how you should define your stretch regions in the 9-patch generator. You'll get a zip file with p-patch images in a few different densities. Put these into your drawables folders.

    enter image description here

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