0
我有一個Android安裝程序,該安裝程序具有一個資源文件,該資源文件引用來自兩個選項中的單個佈局。確定兩個資源ID是否指向相同的佈局
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<resources>
<item name="another_resource_id" type="layout">@layout/some_layout</item>
</resources>
或
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<resources>
<item name="another_resource_id" type="layout">@layout/some_layout2</item>
</resources>
這將產生R.layout
public static final class layout {
...
public static final int another_resource_id=0x7f030000;
public static final int some_layout=0x7f030001;
public static final int some_layout2=0x7f030002;
...
}
所以,問題是,從代碼中,我希望能夠告訴它佈局another_resource_id資源標識符是指。
也許'Resources.getResourceName()'幫助 –
@Jiang YD這隻會返回some_layout或another_resource_id取決於所使用的渣油。 –