F3RN1
F3RN1

Reputation: 179

LinearLyout and ScrollView in android layout

I'm doing a layout for a form to request data from a person. The look I want to give the form is like this:

http://www.subirimagenes.com/otros-formulario-7766528.html

The xml layout file that I have:

<?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"    
android:layout_width="fill_parent"
android:layout_height="fill_parent">

    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="fill_parent">


        <TextView
            android:id="@+id/MiPerfil_TxtTitulo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/MiPerfil_TxtTituloAceptar"
            android:textSize="20sp"
            android:textStyle="bold"
            android:gravity="center" />

        <TextView
            android:id="@+id/idMiPerfil_TxtDNI"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/MiPerfil_TxtDNI"
            android:textSize="16sp" />

        <EditText
            android:id="@+id/MiPerfil_EditTxtDNI"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textSize="18sp" />
        <TextView
            android:id="@+id/idMiPerfil_TxtApellido"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/MiPerfil_TxtApellidos"
            android:textSize="16sp" />
        <EditText
            android:id="@+id/MiPerfil_EditTxtNombre"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textSize="18sp" />
        <TextView
            android:id="@+id/idMiPerfil_TxtNombre"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/MiPerfil_TxtNombre"
            android:textSize="16sp" />

        <EditText
            android:id="@+id/MiPerfil_EditTxtApellido"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textSize="18sp" />

        <TextView
            android:id="@+id/idMiPerfil_TxtTelefono"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/MiPerfil_TxtTelefono"
            android:textSize="16sp" />

        <EditText
            android:id="@+id/MiPerfil_EditTxtTelefono"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textSize="18sp" />

        <TextView
            android:id="@+id/idMiPerfil_TxtEmail"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/MiPerfil_TxtEmail"
            android:textSize="16sp" />

        <EditText
            android:id="@+id/MiPerfil_EditTxtEmail"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textSize="18sp" />

        <TextView
            android:id="@+id/idMiPerfil_TxtDireccion"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/MiPerfil_TxtDireccion"
            android:textSize="16sp" />

        <EditText
            android:id="@+id/MiPerfil_EditTxtDireccion"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textSize="18sp" >

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

When I run it, the following appears:

http://www.subirimagenes.com/otros-form2-7766542.html

I do not understand that I am wrong.

Upvotes: 0

Views: 150

Answers (2)

user
user

Reputation: 87064

Add:

android:orientation="vertical"

to your LinearLayout so its children will be placed one below the other and not one after the other.

Upvotes: 1

MAV
MAV

Reputation: 7457

Add android:orientation = "vertical" to your LinearLayout

A LinearLayout has horizontal orientation as default.

Upvotes: 2

Related Questions