如何解决用户到达结束时如何实现 RecyclerView 项目拉伸效果?
在现代 UI 中,当我们拉下回收视图的顶部时,它的孩子会被拉伸。这发生在用户手指施加的特定压力下。我附上了我从红米手机录制的这种效果的例子。如果我有 CardViews 作为我的 RecyclerView 的孩子,任何人都可以解释如何在 android studio 中实现这种类型(或者更好类型)的效果?
解决方法
在xml中使用swiperrefreshlayout
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/turnaments_list_recy_refresh_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="56dp"
android:layout_marginBottom="?attr/actionBarSize"
android:animateLayoutChanges="true"
android:indeterminateTint="@color/blue_100_dark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/turnaments_list_recy_view"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/image_help_buttom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</androidx.recyclerview.widget.RecyclerView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
在 kotlin 代码中
turnaments_list_recy_refresh_view.isRefreshing = false
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。