我有一个带有标题、5 个 TextView、5 个 Spinner 和 2 个按钮的屏幕,这导致第 5 组 TextView/Spinner 向底部移出屏幕。我已经搜索过在 ConstraintLayout 中有一个 ScrollView 并尝试了我发现的各种事情,将特定的高度和宽度设置为“0dp”并将约束添加到 ScrollView 本身,但仍然唯一发生的事情是出现了 5 个集合,但是仍然不可滚动。我看到了一个与此类似的问题,但它们的底部没有任何内容,因此它们限制在父级的底部。我需要限制在底部按钮的顶部,以便我的按钮保持原位,只有中间滚动,但是当我将底部约束设置为按钮顶部时,整个视图消失了。
这是我当前的 XML
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:context="teamtriplej.com.lipidlator21.CardiolipinsActivity">
<Button
android:id="@+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="16dp"
android:background="@android:color/black"
android:text="@string/Submit"
android:textColor="@android:color/white"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.761"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<Button
android:id="@+id/btnBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:background="@android:color/black"
android:text="@string/Back"
android:textColor="@android:color/white"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.216"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<TextView
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="35dp"
android:text="@string/CLConfiguration"
android:textAlignment="center"
android:textColor="@android:color/black"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="8dp" …Run Code Online (Sandbox Code Playgroud) android android-scrollview android-studio android-constraintlayout