我们在使用组件属性的时候经常会使用
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="减少分数"
这些都是系统属性,我们通过attrs.xml可以自己定义属性
<?xml version="1.0" encoding="utf-8"?>
<resources>
//自定义属性名,定义公共属性
//name=“样式属性名称” format="样式类型如:String、int、color等"
<attr name="titleSize" format="dimension"></attr>
<attr name="titleText" format="string"></attr>
<attr name="titleColor" format="color"></attr>
<attr name="outCircleColor" format="color"></attr>
<attr name="inCircleColor" format="color"></attr>
<attr name="lineColor" format="color"></attr>
//自定义控件的主题样式
//MySportView样式名称
<declare-styleable name="MySportView">
<attr name="titleSize"></attr>
<attr name="titleText"></attr>
<attr name="titleColor"></attr>
<attr name="outCircleColor"></attr>
<attr name="inCircleColor"></attr>
</declare-styleable>
<declare-styleable name="MyQQHealthView">
<attr name="titleColor"></attr>
<attr name="lineColor"></attr>
</declare-styleable>
</resources>