how does a 9patch png work in android apps

ε祈祈猫儿з 提交于 2019-11-26 18:28:42

问题


In a 9patch png, there are black edges in its four sides, but there is usually difference between the left to right, and the up to down side. Why? How does this difference impact?


回答1:


One of simplest ans is

draw the black line according to your requirement using nine patch tools.

You can find more information about how nine patch works here




回答2:


The left and top are for scaling, and the right and bottom are for content. So the black lines on left and top will scale to fit, and the content for a button will be "inside" the black lines on the right and bottom.




回答3:


Here http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch you can find a very good explanation, with images to show you that the left and top part of the black border indicate a stretchable section, while the right and bottom lines define the drawable area, where you can put your content.



来源:https://stackoverflow.com/questions/4517693/how-does-a-9patch-png-work-in-android-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!