getListView()方法找不到为什么..
<ListView
android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp" />
<TextView
android:id="@id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF0000"
android:text="No data" />
xml 这么定义的话.
在Activity里面如何findViewById 或者什么方法拿到这个listview啊
[最优解释]
getListView()需要继承ListActivity才有
[其他解释]
它是使用系统默认的id 必须是"@+id/android:list"
就直接继承ListActivity 然后 setListAdapter(adapter)就可以了。
自定义的话
ListView list=(ListView)findViewById(R.id.list);
list.setListAdapter(adapter)
[其他解释]
你自己都说了findviewById,就是这个方法,只不过这个R要用com.android.R.list