【发布时间】:2015-06-15 16:03:46
【问题描述】:
我正在制作一个包含每 30 秒更新一次的列表视图的 android 应用程序。如果有新数据,我希望出现一个按钮,我可以在其中更新提要,类似于 facebook 应用程序。我怎样才能做到这一点?当不在列表视图中滚动时,有没有办法在出现在屏幕顶部的列表视图顶部覆盖一个按钮?
这是我的列表视图 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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:layout_height="wrap_content"
android:layout_below="@id/header"
android:divider="@android:color/transparent"
android:dividerHeight="10dp"
/>
</LinearLayout>
<Button
android:id="@+id/update_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:text="Button" />
【问题讨论】:
-
我已经实现了,但我希望用户知道何时需要更新提要。有什么建议吗?
标签: java android listview button overlay