我一直試圖在多個資源文件夾中重複使用相同的佈局,但未取得成功。首先我想這裏的操作說明:https://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters並增加了資源文件是這樣的:在多個資源文件夾中重複使用相同的佈局
<resources>
<item name="main" type="layout">@layout/main_twopanes</item>
</resources>
我得到兩個lint警告。第一個是Attribute is missing the Android namespace prefix
。如果我通過添加xmlns:android="http://schemas.android.com/apk/res/android"
來解決該問題,那麼我仍然可以獲得Unexpected text found in layout file: "@layout/layout_file"
。當我嘗試誇大這兩個例外時它會炸燬:
android.view.InflateException: Binary XML file line #2: Error inflating class resources
Caused by: java.lang.ClassNotFoundException: android.view.resources
我正在使用API 15和支持庫。包含/合併技巧似乎並不適用於碎片,因爲這也會爆發一個不同的例外。
有沒有人設法讓這個工作?
謝謝!