0
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background1"
tools:context="com.example.flavours.Category" >
<ImageView
android:id="@+id/homeimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerInParent="true"
android:src="@drawable/ice1"/>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="25dp"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
每次我在更改構建目標(6.0)到(5.0.1)後都沒有生成R(R.id/layout)問題時。 我已經多次清理了該項目,並且當我立即清理了我的項目時,出現了「r」錯誤(R無法解析爲變量)。我還導入了我的(com.example.flavours.R;),但刪除了whn我按下Ctrl + shift + o。新的xml佈局文件沒有被添加到R.java
檢查所有內容的資源文件夾,例如(可繪製的,值和佈局)等。 –
我只有在我的項目中有一個錯誤時纔會遇到這種情況,它會阻止生成R.java;通常是由aapt工具報告的錯誤。這可能是無效的XML或文件名或res /目錄中的其他錯誤。檢查aapt的輸出以查看錯誤是什麼。 – dsh