1 private static final int DEFAULT_BORDER_COLOR = Color.TRANSPARENT;
2 private static final int DEFAULT_BORDER_WIDTH = 0;
3
4 public ImageViewPlus(Context context, AttributeSet attrs) {
5 super(context, attrs);
6 //取xml文件中设定的参数
7 TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ImageViewPlus);
8 mBorderColor = ta.getColor(R.styleable.ImageViewPlus_borderColor, DEFAULT_BORDER_COLOR);
9 mBorderWidth = ta.getDimensionPixelSize(R.styleable.ImageViewPlus_borderWidth, dip2px(DEFAULT_BORDER_WIDTH));
10 ta.recycle();
11 }