相信大家在使用淘宝的时候应该都看到过下拉刷新的效果。这种效果看起来会感觉比较难做,一起来看下下拉刷新。
ListView
思路:
通过FrameLayout底层为下拉刷新的Header,上面一层是ListView,监听手指滑动设置动画效果,移动ListView。
使用:
1、编写ListView顶部下拉刷新的header
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:text="下拉刷新"
/>
</LinearLayout>
2、ListView(后面将会进行动态添加)
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
</ListView>
3、自定义FrameLayout动态添加ListView与header
public