Define integers
suggest changeIntegers are typically stored in a resource file named integers.xml
, but the file name can be chosen arbitrarily. Each integer is defined by using an <integer>
element, as shown in the following file:
res/values/integers.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <integer name="max">100</integer> </resources>
Integers can now be referenced in XML with the syntax @integer/name_of_the_integer
, as shown in the following example:
<ProgressBar android:layout_width="match_parent" android:layout_height="match_parent" android:max="@integer/max"/>
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents