为什么具有约束布局的滚动视图不起作用?

时间:2020-10-24 15:52:19

标签: android scroll scrollview

我使用滚动视图创建了一个布局,并向其添加了约束布局,但是它没有滚动。我认为这个问题是由于布局限制所致。 这是我的XML文件:

<ScrollView 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"
    android:fillViewport="true"
    >
    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
            <androidx.cardview.widget.CardView
                android:id="@+id/crd_main"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                app:layout_constraintVertical_weight="1"
                app:layout_constraintTop_toBottomOf="@id/topViewParent"
                app:layout_constraintBottom_toBottomOf="parent"
                >
                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="30dp">
                    <androidx.cardview.widget.CardView
                        android:id="@+id/crd_plans"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        app:layout_constraintTop_toTopOf="@+id/tv_today_plan"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintLeft_toLeftOf="parent"
                        >
                        <androidx.constraintlayout.widget.ConstraintLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                >

0 个答案:

没有答案