Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ScrollView不工作(它没有滚动布局)_Android_Xml_Scrollview - Fatal编程技术网

Android ScrollView不工作(它没有滚动布局)

Android ScrollView不工作(它没有滚动布局),android,xml,scrollview,Android,Xml,Scrollview,我是Android新手,正在开发一个应用程序,我被困在ScrollView上。我尝试过宽度和高度“匹配父对象”,但仍然不起作用。我正在发布我的代码。我在这上面浪费了一个多小时。提前谢谢 以下是我的XML: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="matc

我是Android新手,正在开发一个应用程序,我被困在ScrollView上。我尝试过宽度和高度“匹配父对象”,但仍然不起作用。我正在发布我的代码。我在这上面浪费了一个多小时。提前谢谢

以下是我的XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:orientation="vertical">

<LinearLayout
    android:id="@+id/linear_header"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="0.02"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:padding="20dp"
        android:text="Marketing"
        android:textColor="@color/black"
        android:textSize="25dp"
        android:textStyle="bold" />


</LinearLayout>

<LinearLayout
    android:id="@+id/linear_register"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/linear_header"
    android:layout_weight="0.02"
    android:background="@color/light_blue"
    android:orientation="vertical">


    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:padding="15dp"
        android:text="Register Here"
        android:textColor="@color/white"
        android:textSize="22dp"
        android:textStyle="bold" />

</LinearLayout>

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/linear_register"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginTop="20dp"
    android:layout_weight="0.04"
    android:orientation="vertical">

    <EditText
        android:id="@+id/edit_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Name*"
        android:inputType="text" />

    <EditText
        android:id="@+id/edit_email"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:hint="Email*"
        android:inputType="text" />

    <EditText
        android:id="@+id/edit_pswd"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:hint="Password*"
        android:inputType="text" />

    <EditText
        android:id="@+id/edit_cnfrm_pswd"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:hint="Confirm Password*"
        android:inputType="text" />

    <Button
        android:id="@+id/btn_register"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginLeft="50dp"
        android:layout_marginRight="50dp"
        android:layout_marginTop="20dp"
        android:background="@drawable/button_bg"
        android:padding="15dp"
        android:text="Register"
        android:textStyle="bold" />


    <TextView
        android:id="@+id/txt_forgot_pswd"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="Forgot/Reset Password"
        android:textColor="@color/light_blue" />

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:weightSum="1"
    android:layout_marginBottom="10dp"
    android:orientation="horizontal">

    <Button
        android:id="@+id/btn_google"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="GOOGLE"
        android:textColor="@color/white"
        android:textStyle="bold"
        android:textSize="15sp"
        android:layout_marginRight="5dp"
        android:background="@color/red"
        android:layout_weight="0.5"/>

    <Button
        android:id="@+id/btn_facebook"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="FACEBOOK"
        android:textColor="@color/white"
        android:background="@color/fb_blue"
        android:layout_marginLeft="5dp"
        android:textStyle="bold"
        android:textSize="15sp"
        android:layout_weight="0.5"/>
</LinearLayout>

    </LinearLayout>
</ScrollView>
</LinearLayout>

设置布局权重以滚动查看

<ScrollView
        android:layout_weight="0.96"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">


父视图中删除
weightSum
属性
并在
线性布局中添加
android:layout\u weight=“0”
而不是
android:layout\u weight=“0.04”
,然后添加
android:layout\u weight=“0”
滚动布局
也。除了滚动问题外,此布局是否正常?因为我可以在一个不太可能的地方看到android:layout_在下面=“@+id/linear_header”