gpt4 book ai didi

android - 如何为无限滚动的 RecyclerView 绘制背景

转载 作者:行者123 更新时间:2023-11-29 01:02:40 44 4
gpt4 key购买 nike

我正在为 Android 应用程序开发一个无限滚动列表,使用 RecyclerView View 组和一个 OnScrollListener 在用户滚动到最后一个项目后添加项目RecyclerView 的。

现在想在项目后面的中间添加一条黑线,作为一种回收 View 。

enter image description here

如您所见,项目可以有不同的高度。

实现此目标的最佳(也是最高效)方法是什么?

最佳答案

您可以考虑使用如下布局。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/your_background">

<android.support.v7.widget.RecyclerView
android:id="@+id/your_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent" />
</RelativeLayout>

关于android - 如何为无限滚动的 RecyclerView 绘制背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49964375/

44 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com