scrollView在framelayout内部不起作用

问题描述 投票:0回答:1

我的scrollview在framelayout中不起作用,这是我的代码,我尝试了很多有关尺寸的问题,但问题不在于尺寸,这是我不知道的其他事情请帮忙 :我还在其他应用程序中尝试了相同的代码,但效果很好,但是在我的代码中,它却没有因此,如果有人之前曾见过此问题或希望与他人分享解决方案,我会尝试在网上找到它,并在StackOverflow中找到此问题,但我的问题尚无答案

  <FrameLayout
        android:id="@+id/cell_content_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#FFF"
        android:visibility="gone">

        <LinearLayout
            android:id="@+id/info_layout"
            android:layout_width="match_parent"
            android:layout_height="400dp"
            android:orientation="vertical"
            android:background="@drawable/myrect">

            <TextView
                android:id="@+id/uni_name_info"
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:text="@string/uni_name"
                android:textColor="@color/white"
                android:background="@drawable/myrect2"
                android:gravity="center">

            </TextView>

            <Space
                android:id="@+id/uni_name_info_space"
                android:layout_width="wrap_content"
                android:layout_height="5dp"/>

            <ImageView
                android:id="@+id/logo_2"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_gravity="center"
                app:srcCompat="@mipmap/ic_launcher">

            </ImageView>

            <Space
                android:id="@+id/logo_2_space"
                android:layout_width="wrap_content"
                android:layout_height="5dp"/>

            <TextView
                android:id="@+id/min_info"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/min"
                android:textColor="@color/white"
                android:background="@drawable/myrect2"
                android:gravity="center">

            </TextView>

            <Space
                android:layout_width="wrap_content"
                android:layout_height="5dp"/>


            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fillViewport="false">


                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content">

                <TextView
                    android:id="@+id/info"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Hello World!"
                    android:textAlignment="center"
                    android:textColor="@color/black"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    android:gravity="center_horizontal" />

                </RelativeLayout>
            </ScrollView>

            <Space
                android:layout_width="wrap_content"
                android:layout_height="5dp"/>

        </LinearLayout>
    </FrameLayout>

You can see the scroll here in the app but it doesn't work

android android-studio scrollview android-framelayout
1个回答
0
投票

您应该删除文本视图上的约束,因为它是相对布局的子级,而不是约束布局。

© www.soinside.com 2019 - 2024. All rights reserved.