水平回收站视图不嵌套

问题描述

我正在尝试制作一个RecyclerView,它将水平嵌套在horizontalscrollview中,我希望它将所有项目扩展到其(LinearLayout)中的布局,但是它只显示3个项目,因为由于某种原因未嵌套...

(出于某些奇怪的原因,在我的api 23仿真器中它可以正常工作,但是在更高级别的api上,它不嵌套...)

xml:

            <horizontalscrollview
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="16dp">

                <androidx.core.widget.nestedScrollView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal">

                        <androidx.recyclerview.widget.RecyclerView
                            android:id="@+id/rv_pick_images"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="horizontal"
                            android:nestedScrollingEnabled="true"
                            app:layoutManager="androidx.recyclerview.widget.linearlayoutmanager" />

                        <ImageView
                            android:id="@+id/btn_take_pictures"
                            android:layout_width="118dp"
                            android:layout_height="147dp"
                            android:layout_marginTop="8dp"
                            android:layout_marginRight="8dp"
                            android:layout_marginBottom="8dp"
                            android:src="@drawable/dashed_rectangle" />

                    </LinearLayout>

                </androidx.core.widget.nestedScrollView>

            </horizontalscrollview>

api 23 :(工作正常)

enter image description here

api 29 :(不起作用)

enter image description here

这些图片并没有真正意义,但是在api 23中,当我滚动显示所有图片并且可以无限滚动时,但是在29中它只显示3,因为RecyclerView没有嵌套。 / p>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)