將佈局xml文件中的視圖的android:text
屬性設置爲@+id/xyz
之類的內容意味着什麼。一個例子可以在這裏複製https://github.com/freezy/android-xbmcremote/blob/master/res/layout/actor_item.xml將android:text設置爲@ + id/xyz的含義
相關代碼中找到:
<TextView
android:text="@+id/actor_name"
android:id="@+id/actor_name"
android:textColor="#ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="@+id/actor_role"
android:id="@+id/actor_role"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
你看過了:http://developer.android.com/training/basics/firstapp/building-ui.html –
這是'android:text =「@ + id/actor_name」'設置文本錯誤。您可以將文本設置爲android:text =「hello」或android:text =「@ string/hello」'。你所要求的是爲'TextView'設置ID。 – Piyush