1、自定义View的属性
2、在View的构造方法中获得我们自定义的属性
3、重写onDraw
<attr name="titleText" format="string" />
<attr name="titleColor" format="color" />
<attr name="titleTextSize" format="dimension" />
<declare-styleable name="CustomTitleView">
<attr name="titleText" />
<attr name="titleColor" />
<attr name="titleTextSize" />
</declare-styleable>
format是值该属性的取值类型:
一共有:string,color,demension,integer,enum,reference,float,boolean,fraction,flag
在构造方法中进行获取属性的值,进行测量 ,然后进行绘制