该类的作用 获取自定义view的属性
1、创建TypedArray对象
使用场景一(view的构造方法中)
TypedArray a = context.obtainStyledAttributes
使用场景二 (view方法之外)
TypedArray a = view.getContext().obtainStyledAttributes
2、使用
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0);
int borderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_border_width, DEFAULT_BORDER_WIDTH);
a.recycle();
<declare-styleable name="CircleImageView">
<attr name="border_width" format="dimension" />
</declare-styleable>
关于