`<?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>
this is what i want for example
如何滚动底部的recyclerview,但底部应保持固定?
答案 0 :(得分:0)
在底页视图中:
android:clickable="false"
android:focusable="false"
在您的回收站视图中:
android:clickable="true"
android:focusable="true"
目标是防止recyclerview将touch事件传递给其父级。
这是我的XML(已验证运行)。我没有使用RV,但是我的图表视图可以平移而不关闭抽屉:
<?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>