ResType
This enum's constants are used to mark that Prop can receive resources of a corresponding Android resource type as values. In addition or instead of usual builder methods this will trigger generation of methods which expect Android resource values or ids as parameter values.
For example: If a CharSequence prop named title
is marked as STRING, this will generate not only method title(CharSequence title)
in the component builder, but also various methods that enable initializing the prop from a string resource or attribute:
titleRes(@StringRes int resId)
titleRes(@StringRes int resId, Object... formatArgs)
titleAttr(@AttrRes int attrResId)
titleAttr(@AttrRes int attrResId, @StringRes int defResId)
int
prop named size
is marked as DIMEN_SIZE, this will not generate a size(int size)
method, but will add a bunch of other methods that accept resources:
sizePx(@Px int sizePx)
sizeRes(@DimenRes int resId)
sizeDip(@Dimension(unit = Dimension.DP) float dip)
sizeAttr(@AttrRes int attrResId)
sizeAttr(@AttrRes int attrResId, @DimenRes int defResId)
See also
Entries
Prop's value can be set from an ArrayRes resource which contains StringRess.
Prop's value can be set from a DimenRes resource or as a DP or PX value.
Prop's value can be set from a DimenRes resource or as a DP, SP or PX value.
Prop's value can be set from a DimenRes resource or as a DP, SP or PX value.