public (Context context) { this(context, null); } public (Context context, AttributeSet attrs) { this(context, attrs, 0); } public (Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); * 获取自定义参数 */ TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.TipView,defStyleAttr,0); radius = ta.getDimension(R.styleable.TipView_radius,radius); arrowHeight = ta.getDimension(R.styleable.TipView_arrowHeight, arrowHeight); bgColor = ta.getColor(R.styleable.TipView_bgColor, bgColor); bgColor_pressed = ta.getColor(R.styleable.TipView_bgColor_pressed, bgColor_pressed); direction = ta.getInt(R.styleable.TipView_direction, direction); nowColor = bgColor; ta.recycle(); mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); init(); }
|
近期评论