PagingListView icon indicating copy to clipboard operation
PagingListView copied to clipboard

How to set empty view in this list?

Open khan-tm opened this issue 7 years ago • 2 comments

It's a very good solution for the pagination. I want to set empty view for the list. When I've tried this way..

In Java file

listView = (PagingListView) rootView.findViewById(R.id.list_view);
listView.setAdapter(adapter);
listView.setEmptyView(rootView.findViewById(R.id.txt_empty));
listView.setHasMoreItems(true);
listView.setPagingableListener(this);

In Layout file

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/txt_empty"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:drawableTop="@drawable/img_user_profile"
        android:text="UNABLE TO CONNECT"
        android:visibility="invisible" />

    <com.paging.listview.PagingListView
        android:id="@+id/list_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</FrameLayout>

Even I've tried with android:id="@android:id/empty" this id, but no success. It's always showing empty view because we have to first setup an empty adapter to this list. I do not want to handle an empty view manually. Is there any way?

khan-tm avatar Jul 27 '17 07:07 khan-tm

Do not really understand. If you want to show a blank screen with no text on it, simple make your listview invisible till you have items to display.

nicolasjafelle avatar Jul 27 '17 11:07 nicolasjafelle

No. i don't want to display blank screen. Even I'm trying to show a Empty Screen Layout (if possible) otherwise a single TextView as declared in xml file.

khan-tm avatar Jul 27 '17 11:07 khan-tm