可能的原因:1. 修改布局文件,使得ListView和EmptyView是兄弟的关系,在一个parent布局的下面。
例如:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ImageView
android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#88000000"
android:visibility="gone"/>
</FrameLayout>
本文介绍了如何在Android中正确配置ListView与EmptyView的布局,确保在ListView为空时能够显示EmptyView。通过使用FrameLayout作为父布局,并设置ListView与EmptyView为兄弟节点,可以实现这一效果。
340

被折叠的 条评论
为什么被折叠?



