I want to have different visibility for each version (JB, KK and L). Then, I have some attr.xml files for each version, before I was using dimen value to set its height to 0 or X dpi, but now I need to remove the view.
What is visibility? is not a dimen, is not a string... how can I get it from my attr to my view with android:visibility="@XXXXXXX/myViewVisibility"
With the height I use android:visibility="@dimen/myViewHeight" and it works perfectly...
Thanks in advance.
It is an enum. You can find the definition for the enum in the framework's attrs.xml (line 2163).
You can use an integer reference if you really want to use a resource reference, but I don't recommend it in case (for whatever reason) those constants change in the future. For example:
<resources>
    <!-- 2 corresponds to "gone" -->
    <integer name="my_visibility">2</integer>
</resources>
<View
    visibility="@integer/my_visiblity" />
A style would also work for version-specific visibility, like so:
<style name="MyViewStyle">
    <item name="android:visibility">gone</item>
</style>
<View
    style="@style/MyViewStyle" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With