我在我的XML聲明的列表視圖:安卓:ID列表視圖
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#F7EFE8">
<ListView android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<TextView android:id="@+id/android:empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_message"/>
</LinearLayout>
但是,當我試圖聲明/用它去渣,該ID是找不到的。但是,當我將列表視圖重命名爲其他內容並嘗試使用它時,我可以看到它「R.id. _」,但是當R.id.list找不到它時。如果我沒有使用android:list,那麼應該有一個列表視圖,其id是android:list。這裏有幫助嗎?
還有什麼包括在您的佈局或可能是你沒有提到的額外細節?我嘗試了一個乾淨的(帶有xml頭文件)佈局文件的代碼片段,但它不起作用。 – Alexandre