1、ListView加脚布局
头布局initHeaderView,在onTouchEvent事件中进行显示隐藏头布局切换
脚布局initFooterView,实现接口OnScrollListener,重写接口方法onScrollStateChanged onScroll 进行显示隐藏脚布局切换
添加标记isLoadingMore,是否正在加载数据,防止多次滑动重复加载数据
<?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="wrap_content" android:gravity="center" android:orientation="horizontal" > <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:indeterminateDrawable="@drawable/custom_progress" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:text="加载中..." android:textColor="#f00" android:textSize="17sp" /> </LinearLayout>