Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Separate Empty VIews for ListVIews
    primarykey
    data
    text
    <p>I want to make multiple empty views for a list view and set them programmatically. So I 've got a listview in an ListActivity. The way my client wants the app, I have a header bar in the app, so the layout looks like this</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/providerListLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;include android:id="@+id/headerBar_ref" android:layout_width="fill_parent" android:layout_height="wrap_content" layout="@layout/header_with_dashboard_button" /&gt; &lt;include android:id="@+id/loadingView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" layout="@layout/loading_view" /&gt; &lt;RelativeLayout android:id="@+id/listViewWrapper" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_below="@id/headerBar_ref" &gt; &lt;ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/headerBar_ref" &gt; &lt;/ListView&gt; &lt;/RelativeLayout&gt; </code></pre> <p></p> <p>So I have the 2 empty views in separate xml files. In the list Activity I try to set the empty view like so:</p> <pre><code>RelativeLayout rootLayout = (RelativeLayout) findViewById(R.id.listViewWrapper); RelativeLayout noFavsLayout = (RelativeLayout) this .getLayoutInflater().inflate(emptyViewLayoutId, rootLayout); getListView().setEmptyView(noFavsLayout); </code></pre> <p>But when I do this, the empty view is there ALL the time. I've also tried to to add the view using addContentView(), but that takes over the whole screen. I've not been able to find a solution on S/O yet</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload