我到达了这个帖子:https://stackoverflow.com/a/9357813/853836,解释了如何使用public.xml资源。
它可以帮助我完成当前的任务,所以我决定创建一个项目来探索,添加:
的strings.xml
<resources>
<string name="app_name">My Application</string>
<string name="string1">String 1</string>
<string name="string2">String 2</string>
<string name="string3">String 3</string>
</resources>
public.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<public type="string" name="string3" id="0x7f040002" />
</resources>
但生成的R文件似乎忽略了public.xml配置。问题在哪里?
public final class R {
...
public static final class string {
public static final int app_name=0x7f070000;
public static final int string1=0x7f070001;
public static final int string2=0x7f070002;
public static final int string3=0x7f070003;
}
}