How do I reference android:gravity values in a resource file?
Concept:
android:gravity="@integer/integer_name"
integers.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer
name="integer_name"
>1</integer>
</resources>
Gravity values are all integer constanst, you have to look it up and define it in your integers.xml .
Example implementation:
public static final int CENTER ... Constant Value: 17 (0x00000011)
in docs... Then you add to your integers.xml in res/values/:
<integer
name="center"
>17</integer>
and in your xml, do:
android:gravity="@integer/center"
Here you go.
<integer name="gravity_bottom">80</integer>
<integer name="gravity_center">17</integer>
<integer name="gravity_center_horizontal">1</integer>
<integer name="gravity_center_vertical">16</integer>
<integer name="gravity_end">8388613</integer>
<integer name="gravity_left">3</integer>
<integer name="gravity_no_gravity">0</integer>
<integer name="gravity_right">5</integer>
<integer name="gravity_start">8388611</integer>
<integer name="gravity_top">48</integer>