How can I allow usage of values like wrap_content
or match_parent
in attrs.xml
resource file on Android?
My attrs.xml
.
<declare-styleable name="BarView">
<attr name="foo_dimen" format="dimension" />
</declare-styleable>
I want the foo_dimen
attribute to be used like this:
<BarView
…
app:foo_dimen="wrap_content" />
<BarView
…
app:foo_dimen="42dp" />
It can be done using
<enum />
:Then you can get the value using Java: