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)
            }
  • 相关阅读:
    线程安全-003-对象锁的同步和异步
    线程安全-002-多个线程多把锁&类锁
    线程安全-001
    FastDFS单节点安装
    Nginx+Keepalived 实现高可用
    linux下配置nginx负载均衡例子
    linux下配置nginx反向代理例子
    Linux命令
    nginx配置文件 nginx.conf 说明
    CentOS安装Nginx 以及日志管理
  • 原文地址:https://www.cnblogs.com/rchao/p/11368676.html
Copyright © 2011-2022 走看看