[英]NestedScrollView inside a ReyciclerView not scrolling
I have a ViewPager
, that contains a RecyclerView
which scrolls vertically and displays items with an adapter.我有一个
ViewPager
,它包含一个RecyclerView
,它垂直滚动并显示带有适配器的项目。 Each item haves a NestedScrollView
, which also should scroll vertically.每个项目都有一个
NestedScrollView
,它也应该垂直滚动。 The problem is that when I try to scroll that NestedScrollView
, it scrolls the parent ViewPager
.问题是,当我尝试滚动
NestedScrollView
时,它会滚动父ViewPager
。
How can i solve this problem?我怎么解决这个问题?
This is the RecyclerView:这是 RecyclerView:
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/offersRecyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/table_cell_background"
android:fadeScrollbars="false"
android:scrollbars="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
This is the layout of the items, which contains the NestedScrollView:这是项目的布局,其中包含 NestedScrollView:
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/statusConstraintLayout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/table_background"
android:padding="@dimen/spacing_small"
app:layout_constraintStart_toEndOf="@+id/salaryConstraintLayout"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.55">
<androidx.core.widget.NestedScrollView
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/statusValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/offer_sent_with_three_dots"
android:textSize="@dimen/mini_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
Also you can try this in the RecyclerView你也可以在 RecyclerView 中试试这个
android:nestedScrollingEnabled="true"
try with by add this attribute app:layout_behavior="@string/appbar_scrolling_view_behavior"
to nestedScrollView尝试通过将此属性
app:layout_behavior="@string/appbar_scrolling_view_behavior"
添加到 nestedScrollView
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.