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>
布局文件

相关文章:

  • 2021-11-05
  • 2021-04-18
  • 2021-12-16
  • 2021-12-08
  • 2021-09-01
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2022-01-04
  • 2022-12-23
  • 2021-05-20
相关资源
相似解决方案