android-recyclerview 相关问题

RecyclerView小部件是ListView和GridView的更高级和灵活的版本。

Android 多个水平回收器视图一起滚动

你好,我有一个 Android 应用程序,其中包含两个像这样的回收器视图 你好,我有一个 Android 应用程序,其中包含两个像这样的回收器视图 <LinearLayout android:layout_width="match_parent" android:orientation="vertical" android:layout_height="wrap_content"> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerViewMainFragment" android:layout_width="match_parent" android:layout_height="wrap_content" /> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerResults" android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> 如何让这个回收器一起滚动? 将此代码放入Scroll View中,它就会自动滚动。 您还可以将多个回收器视图放入线性布局中,它将完美地工作。 <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/hsv" android:layout_width="wrap_content" android:layout_height="wrap_content"> <LinearLayout android:id="@+id/innerLay" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <android.support.v7.widget.RecyclerView android:id="@+id/rv_1" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <android.support.v7.widget.RecyclerView android:id="@+id/rv_2" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> </android.support.v4.widget.NestedScrollView> https://stackoverflow.com/a/43645502/7522720 这会有帮助的 使用 recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); if (isLastItemDisplaying(recyclerView)) { //Calling the method getdata again getData(); } } }); 将第一个回收器视图x和y设置为第二个回收器视图以滚动第一个回收器视图。 https://github.com/dima6120/RecyclerViewsSyncDemo 使用 github 上的演示项目

回答 3 投票 0

从recyclerview列表中删除多个项目(包括最后一项)它会抛出错误IndexOutOfBound

下面的代码用于从 Recyclerview 列表中选择多个项目。 holder.itemView.setOnLongClickListener(View.OnLongClickListener { // if (selectedPosition == 位置) { ...

回答 2 投票 0

Android Studio java - RecyclerView 适配器在 onSave 中返回空歌曲列表

当用户将歌曲从“候选”歌曲列表滑动到最终“歌曲集列表”时,应用程序正在创建歌曲“集列表”。我可以看到这个“设置列表”是创建...

回答 1 投票 0

如何从嵌套回收器视图子适配器返回片段

在我的 kotlin 项目中,从主要活动中,从底部菜单添加了一个片段(peoplenearby 片段)。在该片段中,通过嵌套回收器视图配置文件图像和查看的名称。如果我...

回答 1 投票 0

如何从另一个fragment中获取recycleView的fragment onViewCreated中的数据?

我有片段 WorkoutFragment 和 Bundle,用于将数据传输到片段 DeliteFragment: FragmentManagerfragmentManager = getFragmentManager(); FragmentTransaction 片段事务 =

回答 1 投票 0

当 NestedScrollView 为空时停止 AppBarLayout 滚动离开屏幕

我有一个相当典型的列表功能,使用 CoordinatorLayout、AppBarLayout、SwipeRefreshLayout 和 RecyclerView - 当 RecyclerView 有足够的内容可以滚动时,页面看起来不错。 W...

回答 5 投票 0

在片段上notifyDataSetChanged 不起作用

我正在构建一个应用程序,我有一个聊天我移动到了一个片段中。以前可以用,但现在不行了。 我知道这是一个已知问题,但我仍然无法解决该问题。 当我调试时我可以看到...

回答 1 投票 0

重构。使用 ViewModel 中的 MutableState 在 RecyclerView 中加载数据

我已经密封了类State,我需要将数据从数据类Loaded加载到Fragment中的RecyclerView。如何正确观察fragment中的状态并将其加载到RecyclerView中?主要问题...

回答 1 投票 0

WearOS app:boxedEdges="all" 隐藏 RecyclerView 中的滚动条

有人有办法解决吗? 滚动条可见,没有框边 有人有解决办法吗? 滚动条可见,无需 boxed edges <androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" android:focusable="true" android:focusableInTouchMode="true" android:scrollbars="vertical" /> 但是一旦我添加了盒装边缘app:boxedEdges="all",滚动条就完全消失了。不知道为什么。有人有解决方法或其他解决方案吗? 这是一个大问题,因为如果可滚动视图(RecyclerView、ScrollView)没有滚动条,WearOS 策略现在会立即拒绝所有应用程序。 1 - 尝试使用 WearableRecyclerView 而不是常规的 RecyclerView; 2 - 你真的需要“boxedEdges”吗?如果你这样做,你不能将它添加到容器而不是元素本身吗?或者找到设计的解决方法? 3 - 我不知道它是否会做任何更改,但我喜欢添加“android:orientation=”vertical”参数以及滚动条...

回答 1 投票 0

如果父级在可扩展列表视图 Kotlin 中具有空子级,则删除子级视图

适配器类 ------------------ 类 FilterByTypeExpandableListAdapter(val filterByData: (FilterByItemDataModel) -> Unit) : BaseExpandableListAdapter() { 私人 Lateinit var 父列表:

回答 1 投票 0

Recyclerview 中的单选按钮在 Kotlin 中无法正常工作

适配器类 -------------- 类 FilterByDataAdapter( val filterByData: (ArrayList) -> 单位, val filterByDataRadioBtn: (String) -> 单位 ) : RecyclerView.Adapter<

回答 2 投票 0

Android - recyclerView 下面的 ImageView 粘在底部

我有一个RelativeLayout,在顶部的一张图像内,在Recyclerview下面,在Recyclerview下面我想要一个ImageView,但与屏幕底部对齐。 我有一个RelativeLayout,在顶部的一张图像内,在Recyclerview下方,在Recyclerview下方我想要一个ImageView,但与屏幕底部对齐。 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:adjustViewBounds="true" android:scaleType="fitCenter" android:src="@drawable/logo" /> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerview1" android:layout_marginTop="24sp" android:layout_below="@id/logo" android:layout_width="match_parent" android:layout_height="wrap_content" /> <RelativeLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_below="@id/recyclerview1"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/deco" android:layout_alignParentBottom="true" android:layout_gravity="bottom|center" android:layout_marginBottom="25dp" android:adjustViewBounds="true" android:scaleType="centerInside"/> </RelativeLayout> </RelativeLayout> 但是,只有当 Recyclerview 中没有项目时才会出现底部的图像,否则图像不会显示,列表会滚动到屏幕底部。 好的,通过向 recyclerview 添加 LinearLayput 包装器并添加一些底部边距解决了这个问题。 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rel1" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:adjustViewBounds="true" android:scaleType="fitCenter" android:src="@drawable/logo" /> <LinearLayout android:id="@+id/wrapper" android:layout_below="@+id/logo" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerview1" android:layout_marginTop="24sp" android:layout_marginBottom="80dp" android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/deco" android:layout_alignParentBottom="true" android:layout_gravity="bottom|center" android:layout_marginBottom="16dp" android:adjustViewBounds="true" android:scaleType="centerInside"/> </RelativeLayout>

回答 1 投票 0

无法在 RecyclerView 中从 Firebase Retime 数据库检索数据。 Kotlin Android 工作室

我正在制作一个聊天应用程序。并希望向回收者视图中的所有人展示某项活动,但我无法从应用程序获取人员信息。 我在其中创建了一个名为“USER”的节点,我...

回答 1 投票 0

如何在 RecyclerView Adapter Android 中设置启用或禁用视图

在我的应用程序中,我想使用 Recyclerview 并显示来自服务器的一些数据。 服务器发送给我时间,我应该检查现在的时间,如果服务器时间小于现在时间,我应该为此设置 alpha。 我写

回答 1 投票 0

如何使用RecyclerView.scrollToPosition()将位置移动到当前视图的顶部?

RecyclerView.scrollToPosition() 非常奇怪。 例如,假设有一个名为“rv”的 RecyclerView。 如果现在第 10 项在当前 RecyclerView 下,则调用 rv.scrollToPosition(10),

回答 6 投票 0

如何仅修改父RecyclerView位置0处的第一个嵌套RecyclerView(子)元素?

我有包含嵌套Recyclerview 的parentRecyclerview。 nestedRecyclerView 列出了几个项目:(Apple、Banana、Pear)。我想像这样加粗这个nestedRecyclerview的第一项(苹果)......

回答 1 投票 0

为什么我的 RecyclerView 显示的列表重复?

我有一个带有 RecyclerView 的 Activity,它从我的 Fireabase 数据库获取对象列表。到目前为止,一切都按预期进行。 在适配器上,我有一个按钮可以删除一个对象。这个

回答 1 投票 0

如何防止RecyclerView中的item在滑动返回item时发生跳转?

我有一个 RecyclerView,我想允许用户向左或向右滑动项目以执行操作,然后让项目返回。我实现了这里找到的解决方案,效果很好。目前...

回答 1 投票 0

回收器视图在编辑项目后未更新项目

在我的 Android 应用程序上,我有一个 RecyclerView,其中包含来自名为 Apiario 的类的对象列表。在列表的每一项中,我都提供了删除该项目或编辑其变量之一的选项。我...

回答 1 投票 0

GridLayoutManager spancount 不起作用

我在 android studio java 工作。该应用程序运行,但它仅在一列中显示回收器视图中的项目,而所需的行为是显示两列。我尝试改变跨度...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.