android - How to set custom EmptyView for listview in Navigation Drawer -


i want show custom view empty view in list view in drawer layout! create view in xml , called view_custom_empty.xml:

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="#ffff0000">      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_centerhorizontal="true"         android:layout_centervertical="true"         android:text="no result"         android:textcolor="#ffffffff" />  </relativelayout> 

in activity set list view emptyview this:

view emptyview = getlayoutinflater().inflate(r.layout.view_custom_empty, null); viewgroup viewgroup = (viewgroup) drawerlayout.getparent(); viewgroup.addview(emptyview, 0);  drawerlistview.setemptyview(emptyview); drawerlistview.setadapter(mdraweradapter); 

but custom empty view not appear in listview when it's empty!

as set adapter not null, empty view dismissed. need setadapter when it's ready shown.


Comments

Popular posts from this blog

Linux vanilla kernel on QEMU and networking with eth0 -

rdbms - what exactly the undo information lives in oracle? -

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -