滚动没有被启用



我设计了一个注册屏幕,其中我有一个Scroll view,但Scroll view不工作。

我无法找到为什么滚动不工作,帮助我这个。

下面是供参考的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <include
        android:id="@+id/tool_bar"
        layout="@layout/tool_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    >
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >
        <ImageView
            android:id="@+id/sign_up_profile_image"
            android:layout_width="64dp"
            android:layout_height="64dp"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="30dp"
            android:background="@drawable/shape_rectangle_rounded_corner"
            android:padding="10dp"
            android:scaleType="fitXY"
            android:src="@drawable/icon_avatar" />

        <RelativeLayout
            android:id="@+id/container_two"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/container_three"
            android:layout_below="@+id/sign_up_profile_image"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_marginTop="20dp"
            android:orientation="vertical">
            <LinearLayout
                android:id="@+id/first_last_name_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:weightSum="100">
                <ui.customviews.MaterialEditText
                    android:id="@+id/sign_up_first_name_edit_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="1dp"
                    android:layout_marginTop="2dp"
                    android:layout_weight="50"
                    android:hint="@string/first_name_hint"
                    android:imeOptions="actionNext"
                    android:inputType="textPersonName"
                    android:textSize="18sp"
                    app:baseColor="#363636"
                    app:floatingLabel="normal"
                    app:primaryColor="#000000" />
                <customviews.MaterialEditText
                    android:id="@+id/sign_up_last_name_edit_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="1dp"
                    android:layout_marginTop="2dp"
                    android:layout_weight="50"
                    android:hint="@string/last_name_hint"
                    android:imeOptions="actionNext"
                    android:inputType="textPersonName"
                    android:textSize="18sp"
                    app:baseColor="#363636"
                    app:floatingLabel="normal"
                    app:primaryColor="#000000" />
            </LinearLayout>
            <ui.customviews.MaterialEditText
                android:id="@+id/sign_up_email_edit_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/first_last_name_container"
                android:hint="@string/email"
                android:imeOptions="actionNext"
                android:inputType="textEmailAddress"
                android:textSize="18sp"
                app:baseColor="#363636"
                app:floatingLabel="normal"
                app:primaryColor="#000000"
                />
            <ui.customviews.MaterialEditText
                android:id="@+id/sign_up_password_edit_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/sign_up_email_edit_text"
                android:hint="@string/password"
                android:imeOptions="actionDone"
                android:inputType="textPassword"
                android:textSize="18sp"
                app:baseColor="#363636"
                app:floatingLabel="normal"
                app:primaryColor="#000000" />
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/container_three"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_marginBottom="@dimen/activity_vertical_margin">

            <TextView
                android:id="@+id/sign_up_terms_text_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="5dp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:gravity="center_horizontal"
                android:lineSpacingExtra="2dp"
                android:lineSpacingMultiplier="1.2"
                android:text="By signing up, you accept to the Terms and Conditions and Privacy Policy"
                android:textColor="#6b6b6b"
                android:textSize="14sp" />
            <Button
                android:id="@+id/sign_up_accept_button"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_below="@+id/sign_up_terms_text_view"
                android:layout_marginLeft="@dimen/activity_vertical_margin"
                android:layout_marginRight="@dimen/activity_vertical_margin"
                android:background="#025961"
                android:text="@string/accept_and_signup"
                android:textColor="@android:color/white"
                android:textSize="14sp" />
        </RelativeLayout>
    </RelativeLayout>
</ScrollView>
</LinearLayout>

尝试这样,添加内部线性布局,它将滚动到页面的末尾。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
     <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >
// Your xml Code Put Here
        </LinearLayout>
    </ScrollView>
</Relativelayout>

解决方案可以将ScrollView更改为:

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true"
    >

然后你应该改变嵌套的布局高度

相关内容

  • 没有找到相关文章

最新更新