小编Er.*_*rma的帖子

无法在滚动视图内滚动约束布局

我正在尝试在 ScrollView 中添加约束布局,但布局没有滚动我已经尝试过的:

-> 在nestedscrollview 中放置约束布局

-> 将滚动视图放在另一个约束布局中并设置 height = "0dp", constraintTop_toTopOf = "parent", constraintTop_toTopOf = "bottom"

-> 添加 android:isScrollContainer="true"

这是代码:

<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">


        <TextView
            android:id="@+id/tvItemName"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginEnd="24dp"
            android:layout_marginLeft="24dp"
            android:layout_marginRight="24dp"
            android:layout_marginStart="24dp"
            android:layout_marginTop="32dp"
            android:text="Large antique wardrobe"
            android:textColor="@color/black1"
            android:textSize="24sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView10"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="0dp"
            android:layout_marginStart="0dp"
            android:layout_marginTop="16dp"
            android:text="@string/transit_charge"
            android:textColor="@color/colorPrimary50"
            android:textSize="12sp"
            app:layout_constraintStart_toStartOf="@+id/tvItemName"
            app:layout_constraintTop_toBottomOf="@+id/tvItemName" />

        <TextView
            android:id="@+id/textView11"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="48dp"
            android:layout_marginTop="16dp"
            android:text="@string/required_by"
            android:textColor="@color/colorPrimary50"
            android:textSize="12sp"
            app:layout_constraintStart_toEndOf="@+id/textView10"
            app:layout_constraintTop_toBottomOf="@+id/tvItemName" />

        <TextView
            android:id="@+id/tvPrice"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/black"
            android:textSize="16sp" …
Run Code Online (Sandbox Code Playgroud)

android android-scrollview android-constraintlayout

0
推荐指数
1
解决办法
2658
查看次数