Fork me on GitHub

自定义view


<declare-styleable name="CustomView">
  <attr name="textColor" format="color"/>
  <attr name="textSize" format="dimension"/>
</declare-styleable>
TypedArray array = context.obtainStyledAttributes(attrs,R.styleable.CustomView, defStyle, 0);
mStrokeWidth = array.getDimensionPixelSize(R.styleable.CustomViews_stroke_width, DEFAULT_STROKE_WIDTH);