zoukankan      html  css  js  c++  java
  • SwipeRefreshLayout 下拉刷新

    <androidx.constraintlayout.widget.ConstraintLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:context=".ui.realm.RealmDemo">
    
        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
                android:layout_width="0dp"
                android:layout_height="0dp"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                android:id="@+id/swipe_refresh_layout">
    
            <androidx.recyclerview.widget.RecyclerView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" android:id="@+id/recycle_view"/>
    
        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
    
    
    </androidx.constraintlayout.widget.ConstraintLayout>

    使用比较简单 这里就模拟了一下加载效果 下拉触发加载显示动画此时isRefreshing=true   加载数据后需要修改为false 隐藏动画

    swipe_refresh_layout.isRefreshing = false
            swipe_refresh_layout.setOnRefreshListener {
                Handler().postDelayed({
                    swipe_refresh_layout.isRefreshing = false
                },2000)
            }
  • 相关阅读:
    SDOI2017遗忘的集合
    菜鸡的考场emacs配置
    SDOI2017苹果树
    SDOI2017硬币游戏
    都11点了为什么还没有人阿克离场
    TJOI2013数字根
    HNOI2018毒瘤
    闵可夫斯基和
    三维凸包学习小记
    灭绝树学习小记
  • 原文地址:https://www.cnblogs.com/rchao/p/11368676.html
Copyright © 2011-2022 走看看