我已经在我的应用程序中实现了SwipeRefreshLayout
,但它只能容纳一个直接子元素,这个子元素应该是listview。我正在尝试弄清如何将一个空的textview添加到下面工作的XML文件中:
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@+id/listViewConversation"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:dividerHeight="1dp" />
</android.support.v4.widget.SwipeRefreshLayout>
将其包裹在线性/相对布局中会导致错误,因为当你想向上滑动列表视图时,列表视图将总是更新。我能想到的一种方法是通过编程来实现,但我认为那不是最好的选择。
您可以使用此教程了解如何实现: 下拉刷新指南
所以基本上一切都正常工作,但我想添加一个空视图,以便在列表视图为空时显示消息。
FrameLayout
。 - CommonsWare