<resources>
<!--声明公共属性-->
<attr name="radius" format="dimension" />
<attr name="topLeftRadius" format="dimension" />
<attr name="topRightRadius" format="dimension" />
<attr name="bottomRightRadius" format="dimension" />
<attr name="bottomLeftRadius" format="dimension" />
<declare-styleable name="ShapeButton">
<attr name="solidColor" format="color" />
<attr name="strokeColor" format="color" />
<attr name="strokeWidth" format="dimension" />
<attr name="radius"/>
<attr name="topLeftRadius"/>
<attr name="topRightRadius"/>
<attr name="bottomRightRadius"/>
<attr name="bottomLeftRadius"/>
</declare-styleable>
<declare-styleable name="SelectorButton">
<attr name="radius"/>
<attr name="topLeftRadius"/>
<attr name="topRightRadius"/>
<attr name="bottomRightRadius"/>
<attr name="bottomLeftRadius"/>
</declare-styleable>
</resources>
Android中attrs属性复用
最新推荐文章于 2021-11-22 17:15:06 发布
本文介绍了一种通过XML资源文件自定义按钮样式的实现方法,包括圆形、矩形及带选择器效果的按钮,并详细说明了如何设置颜色、边框宽度和圆角等属性。

360

被折叠的 条评论
为什么被折叠?



