Hi, there is a problem with the setEmptyView method from ListView.
Here is my Java code:
ListView view = (ListView)findViewById(R.id.listView1); view.setEmptyView(findViewById(R.layout.empty_list_item)); ArrayAdapter<Session> adapter1 = new ArrayAdapter<Session>(this, android.R.layout.simple_list_item_1, android.R.id.text1, MainController.getInstanz().getItems()); view.setAdapter(adapter1);
empty_list_item:
<?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/emptyList" > </TextView>
Listview
<ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="wrap_content" >
What is wrong with my code? When I have items, I see them in the list. But when the list is empty, I do not see the TextView .
android listview
gurehbgui Sep 18 '12 at 19:16 2012-09-18 19:16
source share