Android 如何在底页中滚动recyclerview,;但底片不能滑动 `
如何在底部工作表中滚动recyclerview,但底部工作表应保持固定?在底部工作表视图中:Android 如何在底页中滚动recyclerview,;但底片不能滑动 ` ,android,android-recyclerview,Android,Android Recyclerview,如何在底部工作表中滚动recyclerview,但底部工作表应保持固定?在底部工作表视图中: `<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/
`<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MissingPrefix">
<LinearLayout
android:id="@+id/bs"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/bs_bg_shape_corner"
android:focusable="false"
android:focusableInTouchMode="false"
android:orientation="vertical"
app:behavior_hideable="true"
app:behavior_peekHeight="60dp"
app:layout_behavior="@string/bottom_sheet_behavior">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
在您的recyclerview中:
android:clickable="false"
android:focusable="false"
目标是防止recyclerview将触摸事件传递给其父级
这是我的XML(已验证工作)。我没有使用RV,但我的图表视图能够平移而不是关闭抽屉:
android:clickable="true"
android:focusable="true"
对不起,为什么不尝试使用recyclerview…不起作用
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.view.View"/>
<import type="com.example.data.models.pojo.TrackerSettings" />
<variable name="frag" type="com.example.ui.app.tracker.TrackerFragment" />
</data>
<LinearLayout
android:orientation="vertical"
android:layout_gravity="end"
android:id="@+id/graph_sheet"
android:clickable="false"
android:focusable="false"
android:elevation="4dp"
android:gravity="end"
app:behavior_hideable="false"
app:behavior_peekHeight="48dp"
app:layout_behavior="com.example.ui.widgets.BottomSheetBehavior"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/peak"
android:gravity="end"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animIconGraph"
android:layout_width="45dp"
android:layout_height="45dp"
android:background="@drawable/top_rounded"
android:backgroundTint="#aaaaaa"
android:scaleType="centerCrop"
app:lottie_rawRes="@raw/anim_graph"
app:lottie_loop="true"
app:lottie_autoPlay="false"
android:onClick="@{() -> frag.onGraphIconTapped()}"/>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/body"
android:clickable="true"
android:focusable="true"
android:background="@drawable/top_left_rounded"
android:backgroundTint="#aaaaaa"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.50"/>
<com.github.mikephil.charting.charts.LineChart
android:id="@+id/chart"
android:layout_width="0dp"
android:layout_height="200dp"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent"
android:visibility="visible"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>