Android. Empty ListView. Custom message. Very confusing behavior, can't make sense of it
I have a ListView
(part of a ListFragment
), and I noticed that when the list is empty, the message below appears (No matching activities found).
I want to replace that message with a
View
.I've tried
setEmptyView(View emptyView)
.When I do not use
setEmptyView
, the message disappears when list is populated (correct, but I still want 1 above).When I use
setEmptyView
, theemptyView
disappears when list is populated (correct). However, that text message is still there (see figure 1). And worse! Now it doesn't disappear even when list is populated (see figure 开发者_JS百科2: shouldn't it behave just like on 3?).Where does this message come from? the aether? How do I remove it?!?
I had a similar issue with ListFragment
. I create a layout with the ListView
and a View
(an ImageView
in my case) with the id: android:id="@id/android:empty"
, and worked like a charm..
精彩评论