Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.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 特定RelativeLayout上的滚动视图_Android_Layout - Fatal编程技术网

Android 特定RelativeLayout上的滚动视图

Android 特定RelativeLayout上的滚动视图,android,layout,Android,Layout,我需要你在这个设计上的帮助 如您所见,最后一项是微调器,它不适合布局。文本视图所在的布局是相对布局。灰色背景是一个线性布局。因此,我希望能够仅滚动RelativeLayout(具有白色背景的一个),而不是滚动所有LinearLayout。 有办法吗?我真的很感激你的回答 多谢各位 我的代码 <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/r

我需要你在这个设计上的帮助

如您所见,最后一项是微调器,它不适合布局。文本视图所在的布局是相对布局。灰色背景是一个线性布局。因此,我希望能够仅滚动RelativeLayout(具有白色背景的一个),而不是滚动所有LinearLayout。 有办法吗?我真的很感激你的回答

多谢各位

我的代码

<android.support.design.widget.CoordinatorLayout
    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:background="@color/gray">

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

        <RelativeLayout
            android:id="@+id/viewB"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="65dp"
            android:layout_marginEnd="15dp"
            android:layout_marginStart="15dp"
            android:layout_marginTop="45dp"
            android:layout_weight="0.4"
            android:background="@drawable/registro_background"
            android:orientation="horizontal">



            <EditText
                android:id="@+id/ci"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="61dp"
                android:layout_marginStart="15dp"
                android:layout_marginEnd="15dp"
                android:background="@drawable/edit_corner"
                android:gravity="center|left"
                android:hint="CI"
                android:padding="10dp"
                android:textColor="@color/orange"
                android:textColorHint="@color/naranja_lago"
                android:textSize="20sp"
                android:drawableLeft="@drawable/cliente_user"/>

            <EditText
                android:id="@+id/nombre"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignStart="@+id/ci"
                android:layout_below="@+id/ci"
                android:layout_marginTop="12dp"
                android:layout_marginEnd="15dp"
                android:background="@drawable/edit_corner"
                android:drawableLeft="@drawable/cliente_user"
                android:gravity="center|left"
                android:hint="Nombre y Apellido"
                android:padding="10dp"
                android:textColor="@color/orange"
                android:textColorHint="@color/naranja_lago"
                android:textSize="20sp" />

            <EditText
                android:id="@+id/correo"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/nombre"
                android:layout_marginTop="15dp"
                android:layout_marginStart="15dp"
                android:layout_marginEnd="15dp"
                android:background="@drawable/edit_corner"
                android:gravity="center|left"
                android:hint="Email"
                android:padding="10dp"
                android:textColor="@color/orange"
                android:textColorHint="@color/naranja_lago"
                android:textSize="20sp"
                android:inputType="textEmailAddress"
                android:drawableLeft="@drawable/cliente_email"/>

            <EditText
                android:id="@+id/telefono"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/correo"
                android:layout_marginTop="15dp"
                android:layout_marginStart="15dp"
                android:layout_marginEnd="15dp"
                android:background="@drawable/edit_corner"
                android:gravity="center|left"
                android:hint="Teléfono"
                android:padding="10dp"
                android:textColor="@color/orange"
                android:textColorHint="@color/naranja_lago"
                android:textSize="20sp"
                android:inputType="phone"
                android:drawableLeft="@drawable/cliente_phone"/>

            <Spinner
                android:id="@+id/lugar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/telefono"
                android:layout_marginTop="15dp"
                android:layout_marginStart="15dp"
                android:layout_marginEnd="15dp"
                android:background="@drawable/edit_corner"
                android:gravity="center|left"
                android:hint="Lugar"
                android:padding="10dp"
                android:textColor="#6d6e71"
                android:textColorHint="#f7941e"
                android:textSize="20sp" />



        </RelativeLayout>


        <Button
            android:id="@+id/registrar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/button_corner"
            android:layout_marginEnd="15dp"
            android:layout_marginStart="15dp"
            android:layout_marginBottom="15dp"
            android:textColor="@color/white"
            android:text="REGISTRAR"/>




    </LinearLayout>


    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/registro_cliente"
        app:layout_anchor="@id/viewB"
        app:layout_anchorGravity="top|center|center_horizontal" />


</android.support.design.widget.CoordinatorLayout>

我已经测试了一个类似的设置,就像您测试
RelativeLayout
中视图的滚动一样,它对我很有用。请您检查一下它是否适合您:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    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">

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

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:srcCompat="@drawable/ic_launcher_background" />

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
        <RelativeLayout
            android:gravity="center"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button"
                android:layout_marginTop="50dp"
                android:gravity="center"
                tools:layout_editor_absoluteX="16dp"
                tools:layout_editor_absoluteY="26dp" />

            <Button
                android:id="@+id/button2"
                android:layout_below="@id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button"
                android:layout_marginTop="50dp"
                android:gravity="center"
                tools:layout_editor_absoluteX="16dp"
                tools:layout_editor_absoluteY="26dp" />

            <Button
                android:id="@+id/button3"
                android:layout_below="@id/button2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button"
                android:layout_marginTop="50dp"
                android:gravity="center"
                tools:layout_editor_absoluteX="16dp"
                tools:layout_editor_absoluteY="26dp" />

            <Button
                android:id="@+id/button4"
                android:layout_below="@id/button3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button"
                android:layout_marginTop="50dp"
                android:gravity="center"
                tools:layout_editor_absoluteX="16dp"
                tools:layout_editor_absoluteY="26dp" />

            <Button
                android:id="@+id/button5"
                android:layout_below="@id/button4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button"
                android:layout_marginTop="50dp"
                android:gravity="center"
                tools:layout_editor_absoluteX="16dp"
                tools:layout_editor_absoluteY="26dp" />

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

</android.support.constraint.ConstraintLayout>


通常,您应该将scrollview放在弹出窗口内。请向我们展示您的代码以更好地提供帮助。我已经添加了我的代码,请提供帮助您是否尝试在
相对视图
之外添加
滚动视图
,以便
相对视图
滚动视图
的子视图?我添加了,但没有工作。滚动条在相对布局上不起作用。但是如果把卷轴放在线条的外面,那么就把整个布局的卷轴放出来,而这不是我需要它的方式。请检查我的答案,如果它能帮你找到任何线索的话