由於某種原因,我的Android項目編譯正常,在手機和模擬器上運行良好,甚至包括多個帶LinearLayouts,TextViews,按鈕,圖像甚至自定義視圖組件的XML佈局文件,但是當涉及到形狀時,它根本找不到它們。AndroidManifest:忽略未知的'形狀'XML元素
繼承人我的代碼:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<solid android:color="#ffffff"/>
<stroke android:width="3dp"
android:color="#ff000000"/>
<padding android:left="1dp"
android:top="1dp"
android:right="1dp"
android:bottom="1dp"/>
<corners android:radius="30dp"/>
</shape>
我在eclipse獲得圖形佈局錯誤:
com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- shape (Fix Build Path, Edit XML)
- solid (Fix Build Path, Edit XML)
我針對的Android 2.2 Froyo谷歌的API。
對此提出建議?
就在我頭頂,你把這個XML文件放在res/drawable目錄下嗎? – dbryson
不,分辨率。我認爲res/drawable是用於圖像?如何在xml佈局中繪製正方形? – Ring