Android How to add a custom xml file in res/values and how to register the customvalues.xml with the system

后端 未结 3 591
我在风中等你
我在风中等你 2020-12-10 10:53

I want to add a custom xml which having URLs to the res/values folder. I can add the file but how to read its content by getResources() ?

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-10 11:38

    1. Create your custom xml file, ensure it is in res folder (I've tested this by putting it in res/values folder)
    2. Ensure all the values you place in this XML are of a standard type.
    3. You can then use the corresponding R call. For example for integer you do R.integer.YOUR_CUSTOM_XML_VALUE. Doesn't matter which xml this integer is located in, it will be registered by R as long as it is in res folder.

提交回复
热议问题