我在 LinearLayout 中有一个带有 RecyclerView 的布局,它也在自定义 NestedScrollView 中。在 api 21 和 22 中,布局看起来应该显示 RecyclerView 的所有元素,但在 api 23 及更高版本中,仅显示一两个项目,而屏幕的其余部分为空白。我知道 RecyclerView 的重点是不使用 wrap_content,但我的理解是你可以。
我注意到,当 RecyclerView 上方的视图可见时,recyclerview 上的 wrap_content 可以正常工作,但在特定情况下,我遇到的问题是这些视图都以编程方式设置为消失,所以它似乎与此有关。所以我不知道该怎么做,因为这些观点应该已经消失了。这是我无法解决的android sdk错误吗?
<CustomNestedScrollView
android:id="@+id/editProfileScroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical">
<LinearLayout
android:id="@+id/editProfileMainContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/material_baseline_grid_10x"
android:orientation="vertical">
<!-- More code: TextViews and TextViews inside LinearLayouts -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/editProfileFieldsRV"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</CustomNestedScrollView>