2
我正在製作一個包含每30秒更新一次的listview的android應用程序。如果有新數據,我想要一個按鈕出現在可以更新Feed的位置,類似於Facebook應用程序。我怎樣才能做到這一點?在列表視圖中不滾動時,是否有一種方法可以在出現在屏幕頂部的列表視圖上疊加一個按鈕?在列表視圖頂部的覆蓋更新按鈕?
這裏是我的ListView 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" />
我已經實現了該功能,但我希望用戶知道何時需要更新提要。有什麼建議? –