Reputation: 423
I'm using a NestedScrollView with a BottomSheetBehavior. It has one direct child, a ScrollView. When the bottom sheet is expanded, I want to be able to scroll through the contents in the ScrollView, because even when it's expanded, it's still too much to view without scrolling. However, it is not responding. This is the XML:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.thunderbuild.weegnet.fragments.FragmentBridgesMap">
<com.google.android.gms.maps.MapView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/bridges_mv_map"
app:mapType="normal" />
<android.support.v4.widget.NestedScrollView
android:id="@+id/bridges_nsv_sheet"
android:layout_width="match_parent"
android:elevation="4dp"
android:layout_height="350dp"
android:scrollbars="none"
android:background="@android:color/white"
android:clipToPadding="true"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:id="@+id/bridge_sv_content">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/bridge_mv_map"
android:id="@+id/bridge_cl_content"
android:orientation="vertical">
<TextView
android:id="@+id/bridge_tv_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Bridge name"
android:textColor="@color/primaryTextColor"
android:textSize="20sp"
android:layout_marginTop="8dp"
android:layout_marginBottom="0dp"
app:layout_constraintBottom_toTopOf="@+id/linearLayout"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="8dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginRight="8dp"
app:layout_constraintRight_toRightOf="parent" />
<Button
android:id="@+id/bridge_btn_weigh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Weigh"
android:layout_gravity="center_horizontal"
android:background="@drawable/button_style"
android:textColor="@color/lightTextColor"
app:layout_constraintTop_toBottomOf="@+id/ll_opening_times"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="8dp" />
<TextView
android:id="@+id/bridge_tv_status"
android:layout_width="wrap_content"
android:textColor="@color/green"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:text="Opened until..."
app:layout_constraintLeft_toLeftOf="@+id/bridge_tv_name"
app:layout_constraintTop_toBottomOf="@+id/bridge_tv_name"
android:layout_marginTop="8dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginRight="0dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/bridge_tv_status"
app:layout_constraintBottom_toBottomOf="@+id/bridge_tv_status"
android:layout_marginEnd="8dp"
android:id="@+id/linearLayout">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="@color/secondaryTextColor"
android:layout_marginRight="4dp"
android:src="@drawable/ic_car" />
<TextView
android:id="@+id/bridge_tv_eta"
android:layout_gravity="center_vertical|right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5 min." />
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_marker"
android:id="@+id/imageView"
android:tint="@color/colorPrimary"
android:layout_marginLeft="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@+id/bridge_tv_status" />
<LinearLayout
android:id="@+id/ll_opening_times"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp" />
<TextView
android:text="Address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bridge_tv_address"
app:layout_constraintLeft_toLeftOf="@+id/ll_opening_times"
app:layout_constraintBottom_toBottomOf="@+id/imageView"
app:layout_constraintTop_toTopOf="@+id/imageView" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_clock"
android:tint="@color/colorPrimary"
android:id="@+id/imageView2"
app:layout_constraintTop_toTopOf="@+id/ll_opening_times"
app:layout_constraintLeft_toLeftOf="@+id/imageView" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:background="@color/secondaryTextColor"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bridge_tv_address"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="16dp"
app:layout_constraintHorizontal_bias="0.0"
android:id="@+id/view" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
I tried the solution mentioned here but to no avail. Anyone know how to fix this?
EDIT: I'm now noticing that I can scroll, but just not far enough. The content gets cut off at the bottom.
Upvotes: 0
Views: 643
Reputation: 423
One of the problems was that the button had no bottom constraint. I added it and also a lot of margin to its bottom, which prevented it being cut off. It's a sloppy solution but works for now.
Upvotes: 0