I'm trying to make a form that has many textView and editText controls so I tried using scrollview because the screen won't be able to display all of them.
But when I added to a certain set of textview and scrollview, the next one appears on the top side of the screen instead of below the previous set.
Below is my xml, Please help!
XML FILE :
<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"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".InsertJob" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="358dp"
android:orientation="vertical" >
<TextView
android:id="#+id/JobNameTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="#string/name" />
<EditText
android:id="#+id/JobNameET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/JobNameTV"
android:layout_alignBottom="#+id/JobNameTV"
android:layout_marginLeft="70dp"
android:layout_marginRight="20dp"
android:layout_toRightOf="#+id/JobNameTV"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/JobDateTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/JobNameTV"
android:layout_below="#+id/JobNameET"
android:layout_marginTop="25dp"
android:text="#string/date" />
<EditText
android:id="#+id/JobDateET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/JobDateTV"
android:layout_alignBottom="#+id/JobDateTV"
android:layout_alignLeft="#+id/JobNameET"
android:layout_marginRight="20dp"
android:ems="10"
android:hint="#string/date_example"
android:inputType="date" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/JobTimeStartTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/JobDateTV"
android:layout_below="#+id/JobDateTV"
android:layout_marginTop="25dp"
android:text="Jam Mulai" />
<EditText
android:id="#+id/JobTimeStartET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/JobTimeStartTV"
android:layout_alignBottom="#+id/JobTimeStartTV"
android:layout_alignLeft="#+id/JobDateET"
android:layout_marginRight="20dp"
android:ems="10"
android:hint="#string/timeexample"
android:inputType="time" />
<TextView
android:id="#+id/JobTimeEndTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/JobDateTV"
android:layout_below="#+id/JobTimeStartTV"
android:layout_marginTop="25dp"
android:text="Jam Selesai" />
<EditText
android:id="#+id/JobTimeEndET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/JobTimeEndTV"
android:layout_alignBottom="#+id/JobTimeEndTV"
android:layout_alignLeft="#+id/JobDateET"
android:layout_marginRight="20dp"
android:ems="10"
android:hint="#string/timeexample"
android:inputType="time" />
<TextView
android:id="#+id/JobPlaceTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/JobTimeEndTV"
android:layout_below="#+id/JobTimeEndET"
android:layout_marginTop="25dp"
android:text="#string/place" />
<EditText
android:id="#+id/JobPlaceET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/JobPlaceTV"
android:layout_alignBottom="#+id/JobPlaceTV"
android:layout_alignLeft="#+id/JobTimeEndET"
android:layout_marginRight="20dp"
android:ems="10"
android:inputType="text" />
<TextView
android:id="#+id/JobDetailTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/JobPlaceTV"
android:layout_below="#+id/JobPlaceET"
android:layout_marginTop="40dp"
android:text="Detail" />
<EditText
android:id="#+id/JobDetailET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/JobPlaceET"
android:layout_alignBaseline="#+id/JobDetailTV"
android:layout_marginRight="20dp"
android:ems="10"
android:inputType="textMultiLine" />
<TextView
android:id="#+id/SongListTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/JobDetailTV"
android:layout_below="#+id/JobDetailET"
android:layout_marginTop="20dp"
android:text="Lagu 1" />
<EditText
android:id="#+id/SongListET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/JobDetailET"
android:layout_alignBaseline="#+id/SongListTV"
android:ems="10"
android:inputType="text" />
</RelativeLayout>
</ScrollView>
<Button
android:id="#+id/LogoutBtn"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="20dp"
android:layout_marginRight="20dp"
android:background="#drawable/logout"
android:onClick="logout" />
<Button
android:id="#+id/ConfirmBtn"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignBottom="#+id/LogoutBtn"
android:layout_marginLeft="20dp"
android:background="#drawable/confirm" />
</RelativeLayout>
// Try this way,hope this will help you to solve your problem.
<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"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".InsertJob" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="358dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:id="#+id/JobNameTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="#string/name" />
<EditText
android:id="#+id/JobNameET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#id/JobNameTV"
android:layout_marginLeft="70dp"
android:layout_toRightOf="#id/JobNameTV"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/JobDateTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/JobNameET"
android:layout_marginTop="25dp"
android:text="#string/date" />
<EditText
android:id="#+id/JobDateET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/JobNameET"
android:layout_alignBaseline="#id/JobDateTV"
android:layout_toRightOf="#id/JobDateTV"
android:ems="10"
android:hint="#string/date_example"
android:inputType="date" >
</EditText>
<TextView
android:id="#+id/JobTimeStartTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/JobDateTV"
android:layout_marginTop="25dp"
android:text="Jam Mulai" />
<EditText
android:id="#+id/JobTimeStartET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/JobDateET"
android:layout_alignBaseline="#id/JobTimeStartTV"
android:layout_toRightOf="#id/JobTimeStartTV"
android:ems="10"
android:hint="#string/timeexample"
android:inputType="time" />
<TextView
android:id="#+id/JobTimeEndTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/JobTimeStartTV"
android:layout_marginTop="25dp"
android:text="Jam Selesai" />
<EditText
android:id="#+id/JobTimeEndET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/JobTimeStartET"
android:layout_alignBaseline="#id/JobTimeEndTV"
android:layout_toRightOf="#id/JobTimeEndTV"
android:ems="10"
android:hint="#string/timeexample"
android:inputType="time" />
<TextView
android:id="#+id/JobPlaceTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/JobTimeEndTV"
android:layout_marginTop="25dp"
android:text="#string/place" />
<EditText
android:id="#+id/JobPlaceET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/JobTimeEndET"
android:layout_alignBaseline="#id/JobPlaceTV"
android:layout_toRightOf="#id/JobPlaceTV"
android:ems="10"
android:inputType="text" />
<TextView
android:id="#+id/JobDetailTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/JobPlaceTV"
android:layout_marginTop="40dp"
android:text="Detail" />
<EditText
android:id="#+id/JobDetailET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/JobPlaceET"
android:layout_alignBaseline="#id/JobDetailTV"
android:layout_toRightOf="#id/JobDetailTV"
android:ems="10"
android:inputType="textMultiLine" />
<TextView
android:id="#+id/SongListTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/JobDetailTV"
android:layout_marginTop="20dp"
android:text="Lagu 1" />
<EditText
android:id="#+id/SongListET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/JobDetailET"
android:layout_alignBaseline="#id/SongListTV"
android:layout_toRightOf="#id/SongListTV"
android:ems="10"
android:inputType="text" />
</RelativeLayout>
</ScrollView>
<Button
android:id="#+id/LogoutBtn"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="20dp"
android:layout_marginRight="20dp"
android:background="#drawable/logout"
android:onClick="logout" />
<Button
android:id="#+id/ConfirmBtn"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignBottom="#+id/LogoutBtn"
android:layout_marginLeft="20dp"
android:background="#drawable/confirm" />
</RelativeLayout>
EditText JobDateET is missing attribute "android:layout_layout_below="#+id/JobDateTV"
EditText JobTimeStartET is missing attribute "android:layout_layout_below="#+id/JobTimeStartTV"
EditText JobTimeStartET is missing attribute "android:layout_layout_below="#+id/JobTimeStartTV"
Try this.......
<TextView
android:id="#+id/SongListTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/JobDetailTV"
android:layout_marginTop="20dp"
android:text="Lagu 1"/>
Related
Im trying to put a TextView below a multiline EditText and if the EditText starts to grow in height the TextView needs to stay below the EditText, right now if the EditText starts to grow it just covers the TextView below, they are inside a RelativeLayout. Here is the XML of the two objects:
<EditText
android:id="#+id/descripcion_actividad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/descripcion_actividad_label"
android:layout_alignBottom="#+id/descripcion_actividad_label"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_toEndOf="#+id/cantidad"
android:layout_toRightOf="#+id/cantidad"
android:ems="10"
android:inputType="textMultiLine" />
<TextView
android:id="#+id/hora_inicio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/descripcion_actividad"
android:layout_alignParentBottom="false"
android:layout_below="#+id/descripcion_actividad"
android:layout_alignStart="#+id/descripcion_actividad"
android:text="TextView" />
EDIT: Whole layout:
<RelativeLayout 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:id="#+id/activity_third_form_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="dbxprts.terminaltrak.PlanTrabajoActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:theme="#style/ToolBarStyle" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/my_toolbar"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/activity_third_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="dbxprts.terminaltrak.PlanTrabajoActivity">
<Spinner
android:id="#+id/liberado_rechazado"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/tipo_fase"
android:layout_alignStart="#+id/tipo_fase"
android:layout_below="#+id/tipo_fase"
android:layout_marginTop="5dp"
android:entries="#array/array_liberado_rechazado"
android:visibility="gone" />
<Spinner
android:id="#+id/id_cliente"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/id_cliente_label"
android:layout_marginLeft="35dp"
android:layout_toEndOf="#+id/id_realizo_label"
android:layout_toRightOf="#+id/id_realizo_label" />
<TextView
android:id="#+id/hora_inicio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/descripcion_actividad"
android:layout_alignParentBottom="false"
android:layout_alignStart="#+id/descripcion_actividad"
android:layout_below="#+id/descripcion_actividad"
android:layout_marginTop="20dp"
android:text="TextView" />
<TextView
android:id="#+id/descripcion_actividad_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_cliente_label"
android:layout_marginTop="35dp"
android:text="Descripción Actividad:" />
<TextView
android:id="#+id/id_cliente_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_operacion_label"
android:layout_marginTop="35dp"
android:text="ID Cliente:" />
<Spinner
android:id="#+id/id_operacion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/id_operacion_label"
android:layout_marginLeft="25dp"
android:layout_toEndOf="#+id/id_operacion_label"
android:layout_toRightOf="#+id/id_operacion_label" />
<Spinner
android:id="#+id/id_supervisor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/id_supervisor_label"
android:layout_marginLeft="25dp"
android:layout_toEndOf="#+id/id_supervisor_label"
android:layout_toRightOf="#+id/id_supervisor_label" />
<TextView
android:id="#+id/id_operacion_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/cantidad_label"
android:layout_marginTop="35dp"
android:text="ID Operación:" />
<EditText
android:id="#+id/cantidad"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/cantidad_label"
android:layout_alignBottom="#+id/cantidad_label"
android:layout_toEndOf="#+id/id_supervisor_label"
android:layout_toRightOf="#+id/id_supervisor_label"
android:ems="10"
android:inputType="number" />
<TextView
android:id="#+id/cantidad_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_supervisor_label"
android:layout_centerVertical="true"
android:layout_marginTop="35dp"
android:text="Cantidad:" />
<TextView
android:id="#+id/id_programo_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/tipo_fase_label"
android:layout_marginTop="35dp"
android:text="ID Programó:"
android:textSize="15sp" />
<Spinner
android:id="#+id/tipo_fase"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/tipo_fase_label"
android:layout_marginLeft="25dp"
android:layout_toEndOf="#+id/id_plan_label"
android:layout_toRightOf="#+id/id_plan_label"
android:dropDownWidth="match_parent"
android:minWidth="100dip" />
<TextView
android:id="#+id/id_supervisor_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_realizo_label"
android:layout_marginTop="35dp"
android:text="ID Supervisor:" />
<Spinner
android:id="#+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/id_realizo_label"
android:layout_alignLeft="#+id/tipo_fase"
android:layout_alignStart="#+id/tipo_fase"
android:layout_marginLeft="25dp" />
<Button
android:id="#+id/confirmar_cambios"
android:layout_width="120dp"
android:layout_height="55dp"
android:layout_alignParentBottom="true"
android:layout_below="#+id/descarga_cronometro"
android:layout_centerHorizontal="true"
android:elevation="0dp"
android:text="Registrar Fase"
android:textAllCaps="false"
android:visibility="gone" />
<TextView
android:id="#+id/hora_inicio_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignTop="#+id/hora_inicio"
android:text="Hora Inicio:" />
<Spinner
android:id="#+id/via"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/id_programo_label"
android:layout_marginLeft="25dp"
android:layout_toEndOf="#+id/id_programo_label"
android:layout_toRightOf="#+id/id_programo_label" />
<TextView
android:id="#+id/tipo_fase_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_plan_label"
android:layout_marginTop="35dp"
android:layout_toLeftOf="#+id/tipo_fase"
android:layout_toStartOf="#+id/tipo_fase"
android:text="Tipo Fase:"
android:textSize="15sp" />
<TextView
android:id="#+id/id_plan_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="ID Plan Label:"
android:textSize="15sp" />
<EditText
android:id="#+id/descripcion_actividad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/descripcion_actividad_label"
android:layout_alignBottom="#+id/descripcion_actividad_label"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_toEndOf="#+id/cantidad"
android:layout_toRightOf="#+id/cantidad"
android:ems="10"
android:inputType="textMultiLine" />
<TextView
android:id="#+id/id_realizo_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_programo_label"
android:layout_marginTop="35dp"
android:text="ID Realizó:" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Place the EditText and Textview inside a LinearLayout with orientation as vertical
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/rootLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/descripcion_actividad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
--------------------------
--------------------------
android:inputType="textMultiLine" />
<TextView
android:id="#+id/hora_inicio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
--------------------------
--------------------------
android:text="TextView" />
</LinearLayout>
Use a Linearlayout instead .
<LinearLayout
android:layout_width="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
android:layout_height="wrap_content">
<EditText
android:id="#+id/descripcion_actividad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine" />
<TextView
android:id="#+id/hora_inicio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
OR With Relative Layout use
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText
android:id="#+id/descripcion_actividad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:ems="10"
android:inputType="textMultiLine" />
<TextView
android:id="#+id/hora_inicio"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content"
android:layout_below="#+id/descripcion_actividad"
android:text="TextView" />
</RelativeLayout>
Hey I have a ScrollView which allow users to input their credentials in the EditTexts inside. But there's one problem, one of the TextViews prior to its EditText consist of a Spinner but I do not know how to make that Spinner and the TextView side by side. Any help will be appreciated, thanks!:)
My xml:
<ScrollView
android:layout_width="344dp"
android:layout_height="495dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/textView39"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Billing Address"
android:textSize="30dp" />
<TextView
android:id="#+id/textView38"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="20dp"
android:text="First Name"
android:textSize="16dp" />
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="10dp"
android:text="Last Name"
android:textSize="16dp" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView41"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="10dp"
android:text="Street"
android:textSize="16dp" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPostalAddress" />
<TextView
android:id="#+id/textView42"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Country"
android:layout_marginLeft="70dp"
android:layout_marginTop="10dp"
android:textSize="16dp" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="50dp"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
Try this,
<?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:orientation="vertical">
<ScrollView
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp"
android:layout_width="344dp"
android:layout_height="495dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/textView39"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Billing Address"
android:textSize="30dp" />
<TextView
android:id="#+id/textView38"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="20dp"
android:text="First Name"
android:textSize="16dp" />
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="10dp"
android:text="Last Name"
android:textSize="16dp" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="#+id/textView41"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginTop="10dp"
android:text="Street"
android:textSize="16dp" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:ems="10"
android:inputType="textPostalAddress" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/textView42"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:text="Country"
android:textSize="16dp" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="50dp"
android:layout_marginLeft="30dp"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Use Linear Layout after Edittext3 as:
<!--Use dimensions of your choice-->
<LinearLayout
android:orientation="horizontal"
<!-- TO display in center use android:layout_gravity="center" -->
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/textView42"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Country"
android:layout_marginLeft="70dp"
android:textSize="16dp" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="50dp"
android:layout_marginLeft="10dp"
android:layout_height="wrap_content" />
</LinearLayout>
I have a number of data entry screens in my app. In each of them, the last EditText on the screen does not display. It is usable in that you can press in it and type text, but it should be visible also.
Here is the code for one of the screens:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.pdrestimator.Main_Activity$Car_Fragment">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:layout_height="match_parent"
>
<TextView
android:id="#+id/vinLabel"
android:layout_alignParentTop="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="12dp"
android:textSize="20dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="VIN" />
<EditText
android:id="#+id/vin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/carVinLabel"
android:layout_marginRight="10dp"
android:layout_marginLeft="140dp"
android:layout_alignBaseline="#+id/vinLabel"
android:ems="10" />
<TextView
android:id="#+id/yearLabel"
android:layout_below="#+id/vinLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:layout_alignParentLeft="true"
android:layout_marginTop="35dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Year" />
<Spinner
android:id="#+id/year"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/yearLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBaseline="#+id/yearLabel"
android:ems="10" />
<TextView
android:id="#+id/makeLabel"
android:layout_below="#+id/yearLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textSize="20dp"
android:layout_marginTop="48dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Make" />
<AutoCompleteTextView
android:id="#+id/make"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/yearLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBaseline="#+id/makeLabel"
android:ems="10" />
<TextView
android:id="#+id/modelLabel"
android:layout_below="#+id/makeLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textSize="20dp"
android:layout_marginTop="35dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Model" />
<EditText
android:id="#+id/model"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/modelLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBaseline="#+id/modelLabel"
android:ems="10" />
<TextView
android:id="#+id/colorLabel"
android:layout_below="#+id/modelLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="35dp"
android:textSize="20dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Color" />
<AutoCompleteTextView
android:id="#+id/color"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/colorLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBaseline="#+id/colorLabel"
android:ems="10" />
<TextView
android:id="#+id/manufactureDateLabel"
android:layout_below="#+id/colorLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textSize="20dp"
android:layout_marginTop="35dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Manuf. Date" />
<EditText
android:id="#+id/manufactureDate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/manufactureDateLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBaseline="#+id/manufactureDateLabel"
android:ems="10" />
<TextView
android:id="#+id/stockNumberLabel"
android:layout_below="#+id/manufactureDateLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textSize="20dp"
android:layout_marginTop="35dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Stock Number" />
<EditText
android:id="#+id/stockNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/stockNumberLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBaseline="#+id/stockNumberLabel"
android:ems="10" />
</RelativeLayout>
</ScrollView>
Any help would be greatly appreciated!
<EditText
android:id="#+id/stockNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/stockNumberLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBottom="#+id/stockNumberLabel"
android:ems="10" />
layout_alignBottom instead of baseline does the trick!
Worth looking at this
Use this
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.pdrestimator.Main_Activity$Car_Fragment">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/vinLabel"
android:layout_alignParentTop="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="12dp"
android:textSize="20dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="VIN" />
<EditText
android:id="#+id/vin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/vinLabel"
android:layout_marginRight="10dp"
android:layout_marginLeft="140dp"
android:layout_alignBaseline="#+id/vinLabel"
android:ems="10" />
<TextView
android:id="#+id/yearLabel"
android:layout_below="#+id/vinLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:layout_alignParentLeft="true"
android:layout_marginTop="35dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Year" />
<Spinner
android:id="#+id/year"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/yearLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBaseline="#+id/yearLabel"
android:ems="10" />
<TextView
android:id="#+id/makeLabel"
android:layout_below="#+id/yearLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textSize="20dp"
android:layout_marginTop="48dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Make" />
<AutoCompleteTextView
android:id="#+id/make"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/yearLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBaseline="#+id/makeLabel"
android:ems="10" />
<TextView
android:id="#+id/modelLabel"
android:layout_below="#+id/makeLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textSize="20dp"
android:layout_marginTop="35dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Model" />
<EditText
android:id="#+id/model"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/modelLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBaseline="#+id/modelLabel"
android:ems="10" />
<TextView
android:id="#+id/colorLabel"
android:layout_below="#+id/modelLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="35dp"
android:textSize="20dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Color" />
<AutoCompleteTextView
android:id="#+id/color"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/colorLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBaseline="#+id/colorLabel"
android:ems="10" />
<TextView
android:id="#+id/manufactureDateLabel"
android:layout_below="#+id/colorLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textSize="20dp"
android:layout_marginTop="35dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Manuf. Date" />
<EditText
android:id="#+id/manufactureDate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/manufactureDateLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBaseline="#+id/manufactureDateLabel"
android:ems="10" />
<TextView
android:id="#+id/stockNumberLabel"
android:layout_below="#+id/manufactureDateLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textSize="20dp"
android:layout_marginTop="35dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="Stock Number" />
<EditText
android:id="#+id/stockNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/stockNumberLabel"
android:layout_alignLeft="#+id/vin"
android:layout_alignRight="#+id/vin"
android:layout_alignBottom="#+id/stockNumberLabel"
android:ems="10" />
</RelativeLayout>
i have one RelativeLayout and i have some views(image and edittexts) and now i want to use scrollview.this is a my xml code
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginTop="70dp" >
<ImageView
android:id="#+id/loginbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/passwordfild"
android:layout_alignRight="#+id/passwordfild"
android:layout_below="#+id/passwordfild"
android:layout_marginTop="28dp"
android:background="#drawable/login"
android:textColor="#ffffff" />
<EditText
android:id="#+id/passwordfild"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/namefild"
android:layout_alignRight="#+id/namefild"
android:layout_centerVertical="true"
android:background="#drawable/edittextbackground"
android:ems="10"
android:hint="პაროლი"
android:inputType="textPassword"
android:paddingLeft="15dp"
android:textColorHint="#e2e0e0" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/namefild"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/passwordfild"
android:layout_marginBottom="42dp"
android:layout_marginLeft="175dp"
android:layout_marginRight="175dp"
android:background="#drawable/edittextbackground"
android:ems="10"
android:hint="სახელი"
android:paddingLeft="15dp"
android:textColorHint="#e2e0e0" >
<requestFocus />
</EditText>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/namefild"
android:layout_alignLeft="#+id/namefild"
android:layout_alignRight="#+id/namefild"
android:layout_marginBottom="100dp"
android:background="#drawable/icon" />
</RelativeLayout>
also i added
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="70dp" >
and i inserted my relative layout inside my scrollview but design has changed.i have no idea what am i doing wrong
if anyone knows solution please help me
use android:fillViewport="true" inside the ScrollView
do like this,
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mainlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E0FFFF" >
<TextView
android:id="#+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:text="Portal Trading Ltd."
android:textSize="18sp"
android:textStyle="italic" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tvSackNo"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text="Santa Sacks"
android:textSize="40sp" />
<Button
android:id="#+id/btnEdit"
android:layout_width="100dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="21dp"
android:text="Edit"
android:textSize="25sp" />
<Button
android:id="#+id/btnConfirm"
android:layout_width="100dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="21dp"
android:text="Confirm"
android:textSize="21sp" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/textView2"
android:gravity="center"
android:text="Printed Name Details"
android:textSize="22sp" />
<TextView
android:id="#+id/tvExtraCharge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView3"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="Confirmation Page"
android:textSize="12sp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/btnEdit"
android:layout_alignParentLeft="true"
android:layout_below="#+id/tvExtraCharge"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/sackscontainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
I have created a layout with edit boxes ,textfields,buttons and images etc. But when i try to type something in my edit box the keyboard appears and my layout changes horribly .how can i fix this?
before keyboard appears
after keyboard appears
my layout
<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"
android:background="#color/grey"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="#+id/contactus_heading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="#string/cinema_contactus"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20dp" />
<EditText
android:id="#+id/contactus_name_edittext"
android:layout_width="340dp"
android:layout_height="40dp"
android:layout_above="#+id/contactus_email_edittext"
android:layout_alignLeft="#+id/contactus_email_edittext"
android:layout_alignRight="#+id/contactus_email_edittext"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:background="#drawable/rounded_edittext"
android:ems="10"
android:hint="Name"
android:textSize="12sp" />
<EditText
android:id="#+id/contactus_email_edittext"
android:layout_width="340dp"
android:layout_height="40dp"
android:layout_above="#+id/contactus_message_edittext"
android:layout_marginBottom="20dp"
android:layout_toRightOf="#+id/fax"
android:background="#drawable/rounded_edittext"
android:ems="10"
android:hint="E-mail"
android:textSize="12sp" />
<EditText
android:id="#+id/contactus_message_edittext"
android:layout_width="340dp"
android:layout_height="115dp"
android:layout_above="#+id/contactus_submit_button"
android:layout_alignLeft="#+id/contactus_email_edittext"
android:layout_alignRight="#+id/contactus_email_edittext"
android:layout_marginBottom="20dp"
android:background="#drawable/rounded_edittext"
android:ems="10"
android:gravity="top|left"
android:hint="Message"
android:textSize="12sp" />
<Button
android:id="#+id/contactus_submit_button"
android:layout_width="125dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/mybutton"
android:text="#string/submit"
android:layout_marginBottom="30dp"
android:layout_marginTop="20dp"
android:textSize="14dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
<ImageView
android:id="#+id/emailedit"
android:layout_width="45dp"
android:layout_height="40dp"
android:layout_alignTop="#+id/contactus_email_edittext"
android:layout_toLeftOf="#+id/contactus_email_edittext"
android:src="#drawable/emailtop" />
<ImageView
android:id="#+id/nameedit"
android:layout_width="45dp"
android:layout_height="40dp"
android:layout_alignTop="#+id/contactus_name_edittext"
android:layout_toLeftOf="#+id/contactus_name_edittext"
android:src="#drawable/nametop" />
<ImageView
android:id="#+id/messageedit"
android:layout_width="45dp"
android:layout_height="115dp"
android:layout_alignTop="#+id/contactus_message_edittext"
android:layout_toLeftOf="#+id/contactus_message_edittext"
android:src="#drawable/messagetop" />
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/contactus_submit_button"
android:layout_below="#+id/contactus_email_edittext"
android:orientation="horizontal" >
</LinearLayout>
<ImageView
android:id="#+id/fax"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignTop="#+id/contactus_telephone2"
android:layout_toLeftOf="#+id/contactus_telephone2"
android:layout_marginTop="3dp"
android:src="#drawable/fax" />
<ImageView
android:id="#+id/email"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignTop="#+id/contactus_email"
android:layout_toLeftOf="#+id/contactus_email"
android:layout_marginTop="3dp"
android:src="#drawable/message" />
<ImageView
android:id="#+id/telephone"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignTop="#+id/contactus_telephone1"
android:layout_toLeftOf="#+id/contactus_telephone1"
android:layout_marginTop="3dp"
android:src="#drawable/call" />
<ImageView
android:id="#+id/addresspointer"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignLeft="#+id/telephone"
android:layout_alignTop="#+id/contactus_address"
android:layout_marginTop="3dp"
android:src="#drawable/pointer" />
<TextView
android:id="#+id/contactus_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/contactus_submit_button"
android:layout_centerHorizontal="true"
android:text="#string/cinema_contactus_address"
android:textColor="#000000"
android:lineSpacingExtra="5dp"
android:textSize="14sp"
android:layout_marginTop="25dp" />
<TextView
android:id="#+id/contactus_telephone1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/contactus_address"
android:layout_below="#+id/contactus_address"
android:text="#string/cinema_contactus_telephone1"
android:textColor="#000000"
android:layout_marginTop="5dp"
android:textSize="14sp" />
<TextView
android:id="#+id/contactus_telephone2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/telephone"
android:layout_toRightOf="#+id/telephone"
android:text="#string/cinema_contactus_telephone2"
android:textColor="#000000"
android:layout_marginTop="5dp"
android:textSize="14sp" />
<TextView
android:id="#+id/contactus_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/contactus_telephone2"
android:layout_below="#+id/contactus_telephone1"
android:text="#string/cinema_contactus_email"
android:textColor="#000000"
android:layout_marginTop="5dp"
android:textSize="14sp" />
</RelativeLayout>
try this
inside onCreate write
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
Ok found the answer
i just had to add the following in my activity in manifest
android:windowSoftInputMode="adjustPan"