Sunday 26 February 2017

Glimpse

Android View Styleable Attribute Binding

Easily obtain and bind styleable attribute values. Annotate your styleable fields:

java @Styleable(R.styleable.CustomView_showText) boolean showText; @ColorInt @Styleable(value = R.styleable.CustomView_textColor, defaultRes = R.color.default_text_color) int textColor;

Then call the static obtain method providing the View object instance as the target, the AttributeSet containing the values, and any additional parameters:

java Glimpse.obtain(this, attrs);



from The Android Arsenal

No comments:

Post a Comment