How does you register a custom xml-resource-file with android studio so that you can reference it from other xml files?
I understand that its possible to call values from new resource values programmatically using R but I was wondering if there was a way to do that statically from another XML file.
For example, referencing that new file (in this case called keys.xml) in another xml file
Just create a resource file like:
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="testKey">TEST_VALUE</string> </resources>
In code, you can call:
From another xml:
<TextView ... android:text="@string/testKey" ... />
The trick is you declare as a
<resources> in your xml file.