码迷,mamicode.com
首页 > 其他好文 > 详细

按钮使用9patch图片不显示文字

时间:2016-09-10 17:51:17      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:

关于9patch的google说明 https://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch

You can also define an optional drawable section of the image (effectively, the padding lines) by drawing a line on the right and bottom lines. If a View object sets the NinePatch as its background and then specifies the View‘s text, it will stretch itself so that all the text fits inside only the area designated by the right and bottom lines (if included). If the padding lines are not included, Android uses the left and top lines to define this drawable area.

这个图片定义一个可选区域在底部和右边,如果一个9patch作为一个背景并且这个视图包含文本信息,9patch图将伸展让所有的文字能够适配在底部和右边的那个黑线内,如果padding线没有,那么android就会使用上边和左边的线来定义这个drawable区域(也就是上部和左边的那个黑线所规定的区域来显示文字,这样的话如果你上边和左边为了伸缩图片只画了一个点那么文字就不会被显示了)

技术分享

按钮使用9patch图片不显示文字

标签:

原文地址:http://www.cnblogs.com/xxss0903/p/5859672.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!