EditText Field not working good when run the app - android

Developing an app which have 9 edittext fields.
Have a problem with edittext field. It looks fine on xml layout but when i run the app on emulator these field are all around the screen. And when run on real mob they even look worse .(they place themself all around the screen not where i set them )..Don't know what to do. Here is the xml code.
<?xml version="1.0" encoding="utf-8"?>
<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="#drawable/zmal"
tools:ignore="ExtraText" >
<TextView
android:id="#+id/showz"
android:layout_width="200dp"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:fontFamily="bold"
android:textColor="#fefdfd"
android:textSize="20sp" />
<Button
android:id="#+id/calc"
android:layout_width="80dp"
android:layout_height="45dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#drawable/calbu" />
<EditText
android:id="#+id/zktmal6"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal8"
android:layout_alignParentRight="true"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal8"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal9"
android:layout_alignParentRight="true"
android:layout_marginBottom="20dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal5"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal6"
android:layout_alignParentRight="true"
android:layout_marginBottom="35dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal4"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal5"
android:layout_alignParentRight="true"
android:layout_marginBottom="14dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal9"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/calc"
android:layout_alignParentRight="true"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal1"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal2"
android:layout_alignParentRight="true"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal3"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal4"
android:layout_alignParentRight="true"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal10"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal1"
android:layout_alignParentRight="true"
android:ems="10"
android:inputType="number"
android:textSize="12sp" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/zktmal2"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal3"
android:layout_alignParentRight="true"
android:layout_marginBottom="14dp"
android:ems="10"
android:inputType="number"
android:textSize="12sp" />
</RelativeLayout>

you can change the width and the height of the items you want.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/showz"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fontFamily="bold"
android:textColor="#fefdfd"
android:textSize="20sp" />
<Button
android:id="#+id/calc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/calbu" />
<EditText
android:id="#+id/zktmal6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal8"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_marginBottom="20dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal5"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_marginBottom="35dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal4"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_marginBottom="14dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal9"
android:layout_width="60dp"
android:layout_height="32dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal1"
android:layout_width="60dp"
android:layout_height="32dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal3"
android:layout_width="60dp"
android:layout_height="32dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal10"
android:layout_width="60dp"
android:layout_height="32dp"
android:ems="10"
android:inputType="number"
android:textSize="12sp" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/zktmal2"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_marginBottom="14dp"
android:ems="10"
android:inputType="number"
android:textSize="12sp" />
</LinearLayout>

In the xml you set:android:layout_above="#+id/YourViewName" I'm think it should be android:layout_above="#id/YourViewName" because you are specifing an id you already created not trying to generate a new one.

Create one by one from bottom to top:
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:ignore="ExtraText" >
<TextView
android:id="#+id/showz"
android:layout_width="200dp"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:fontFamily="bold"
android:textColor="#fefdfd"
android:textSize="20sp" />
<Button
android:id="#+id/calc"
android:layout_width="80dp"
android:layout_height="45dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" />
<EditText
android:id="#+id/zktmal9"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/calc"
android:layout_alignParentRight="true"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal8"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal9"
android:layout_alignParentRight="true"
android:layout_marginBottom="20dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal6"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal8"
android:layout_alignParentRight="true"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal5"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal6"
android:layout_alignParentRight="true"
android:layout_marginBottom="35dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal4"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal5"
android:layout_alignParentRight="true"
android:layout_marginBottom="14dp"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal3"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal4"
android:layout_alignParentRight="true"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal2"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal3"
android:layout_alignParentRight="true"
android:layout_marginBottom="14dp"
android:ems="10"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal1"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal2"
android:layout_alignParentRight="true"
android:inputType="number"
android:textSize="12sp" />
<EditText
android:id="#+id/zktmal10"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_above="#+id/zktmal1"
android:layout_alignParentRight="true"
android:ems="10"
android:inputType="number"
android:textSize="12sp" >
<requestFocus />
</EditText>
</RelativeLayout>

Related

windowSoftInputMode doesn't working

I added the windowSoftInputMode in my AndroidManifest but it doesn't work. I tried put adjustPan, adjustResize, but nothing work.
AndroidManifest.xml:
<activity
android:name="com.evehx.evehx.view.CreateAgendamentosActivity"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait"/>
activity_create_agendamentos.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:background="#color/bg_main"
android:fitsSystemWindows="true"
tools:context=".view.CreateAgendamentosActivity">
<TextView
android:id="#+id/textView2"
android:layout_width="320dp"
android:layout_height="45dp"
android:layout_centerHorizontal="true"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical|center_horizontal"
android:text="#string/lbl_titleAgendamento"
android:textColor="#color/white"
android:textSize="30sp" />
<RadioGroup
android:id="#+id/radioGroup2"
android:layout_width="338dp"
android:layout_height="45dp"
android:orientation="horizontal"
android:layout_below="#+id/textView2"
android:layout_centerHorizontal="true">
<RadioButton
android:id="#+id/radioProtensao"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.79"
android:buttonTint="#color/white"
android:gravity="center_vertical|center|start"
android:text="#string/opt_Protensao"
android:textColor="#color/white"
android:textSize="20sp" />
<RadioButton
android:id="#+id/radioLocacao"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.40"
android:buttonTint="#color/white"
android:gravity="center_vertical|center|start"
android:text="#string/opt_Locacao"
android:textColor="#color/white"
android:textSize="20sp" />
</RadioGroup>
<RadioGroup
android:id="#+id/radioGroup"
android:layout_width="338dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="#+id/radioGroup2"
android:layout_alignLeft="#+id/radioGroup2"
android:layout_alignStart="#+id/radioGroup2">
<RadioButton
android:id="#+id/radioEntrega"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#color/white"
android:gravity="center_vertical|center|start"
android:text="#string/opt_Entrega"
android:textColor="#color/white"
android:textSize="20sp" />
<RadioButton
android:id="#+id/radioRetirada"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.40"
android:buttonTint="#color/white"
android:gravity="center_vertical|center|start"
android:text="#string/opt_Retirada"
android:textColor="#color/white"
android:textSize="20sp" />
</RadioGroup>
<Spinner
android:id="#+id/cmbObras"
android:layout_width="match_parent"
android:layout_height="45dp"
android:backgroundTint="#color/white"
android:layout_below="#+id/radioGroup"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="12dp" />
<Spinner
android:id="#+id/cmbPavimento"
android:layout_width="match_parent"
android:layout_height="45dp"
android:backgroundTint="#color/white"
android:layout_below="#+id/cmbObras"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="12dp" />
<EditText
android:id="#+id/txtDataAgendamento"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/cmbPavimento"
android:layout_marginTop="11dp"
android:background="#color/white"
android:enabled="false"
android:gravity="center_vertical|center_horizontal"
android:hint="#string/dataEntregaRetirada"
android:inputType="textCapWords"
android:maxLines="1"
android:padding="10dp"
android:textColor="#color/input_register"
android:layout_toLeftOf="#+id/button1"
android:layout_toStartOf="#+id/button1" />
<ImageButton
android:id="#+id/button1"
android:layout_width="52dp"
android:layout_height="45dp"
android:layout_marginLeft="8dp"
android:background="#drawable/calendar"
android:onClick="setDate"
android:scaleType="fitXY"
android:layout_alignTop="#+id/txtDataAgendamento"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
android:id="#+id/txtVersaoProjeto"
android:layout_width="357dp"
android:layout_height="45dp"
android:background="#color/white"
android:backgroundTint="#color/white"
android:ems="10"
android:gravity="top"
android:hint="#string/ultimaVersaoProjeto"
android:inputType="textMultiLine"
android:lines="1"
android:paddingLeft="10dp"
android:scrollbars="vertical"
android:layout_marginTop="14dp"
android:layout_below="#+id/txtDataAgendamento"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText
android:id="#+id/txtDetalhesAgendamento"
android:layout_width="352dp"
android:layout_height="match_parent"
android:layout_above="#id/btnNovoAgendamentos"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/txtVersaoProjeto"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:background="#color/white"
android:backgroundTint="#color/white"
android:ems="10"
android:gravity="top"
android:hint="#string/detalhes"
android:inputType="textMultiLine"
android:lines="12"
android:paddingLeft="10dp"
android:paddingBottom="16dp"
android:scrollbars="vertical" />
<Button
android:id="#+id/btnNovoAgendamentos"
android:layout_width="352dp"
android:layout_height="48dp"
android:layout_marginBottom="16dp"
android:background="#color/btn_default_bg"
android:text="#string/btn_send"
android:textColor="#color/btn_default"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
When i touch on the last edit text, only the button float whit the keyboard.
Result on edit text touch
How can i do for the edittext's move up together with the button?
I solved the problem putting a scroll view:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="#color/bg_main">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<LinearLayout
android:id="#+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentTop="true">
<TextView
android:id="#+id/textView2"
android:layout_width="320dp"
android:layout_height="45dp"
android:layout_centerHorizontal="true"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical|center_horizontal"
android:text="#string/lbl_titleAgendamento"
android:textColor="#color/white"
android:textSize="30sp" />
<RadioGroup
android:id="#+id/radioGroup2"
android:layout_width="338dp"
android:layout_height="45dp"
android:layout_below="#+id/textView2"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<RadioButton
android:id="#+id/radioProtensao"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.79"
android:buttonTint="#color/white"
android:gravity="center_vertical|center|start"
android:text="#string/opt_Protensao"
android:textColor="#color/white"
android:textSize="20sp" />
<RadioButton
android:id="#+id/radioLocacao"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.40"
android:buttonTint="#color/white"
android:gravity="center_vertical|center|start"
android:text="#string/opt_Locacao"
android:textColor="#color/white"
android:textSize="20sp" />
</RadioGroup>
<RadioGroup
android:id="#+id/radioGroup"
android:layout_width="338dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/radioGroup2"
android:layout_alignStart="#+id/radioGroup2"
android:layout_below="#+id/radioGroup2"
android:orientation="horizontal">
<RadioButton
android:id="#+id/radioEntrega"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="#color/white"
android:gravity="center_vertical|center|start"
android:text="#string/opt_Entrega"
android:textColor="#color/white"
android:textSize="20sp" />
<RadioButton
android:id="#+id/radioRetirada"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.40"
android:buttonTint="#color/white"
android:gravity="center_vertical|center|start"
android:text="#string/opt_Retirada"
android:textColor="#color/white"
android:textSize="20sp" />
</RadioGroup>
<Spinner
android:id="#+id/cmbObras"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/radioGroup"
android:layout_marginTop="12dp"
android:backgroundTint="#color/white" />
<Spinner
android:id="#+id/cmbPavimento"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/cmbObras"
android:layout_marginTop="12dp"
android:backgroundTint="#color/white" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="#+id/txtDataAgendamento"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="11dp"
android:layout_toLeftOf="#+id/button1"
android:layout_toStartOf="#+id/button1"
android:background="#color/white"
android:enabled="false"
android:gravity="center_vertical|center_horizontal"
android:hint="#string/dataEntregaRetirada"
android:inputType="textCapWords"
android:maxLines="1"
android:padding="10dp"
android:textColor="#color/input_register" />
<ImageButton
android:id="#+id/button1"
android:layout_width="52dp"
android:layout_height="45dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/txtDataAgendamento"
android:layout_marginLeft="8dp"
android:background="#drawable/calendar"
android:onClick="setDate"
android:scaleType="fitXY" />
</RelativeLayout>
<EditText
android:id="#+id/txtVersaoProjeto"
android:layout_width="357dp"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/txtDataAgendamento"
android:layout_marginTop="14dp"
android:background="#color/white"
android:backgroundTint="#color/white"
android:ems="10"
android:gravity="top"
android:hint="#string/ultimaVersaoProjeto"
android:inputType="textMultiLine"
android:lines="1"
android:paddingLeft="10dp"
android:scrollbars="vertical" />
<EditText
android:id="#+id/txtDetalhesAgendamento"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/txtVersaoProjeto"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:background="#color/white"
android:backgroundTint="#color/white"
android:ems="10"
android:gravity="top"
android:hint="#string/detalhes"
android:inputType="textMultiLine"
android:lines="12"
android:paddingBottom="16dp"
android:paddingLeft="10dp"
android:scrollbars="vertical" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="#+id/mainLayout"
android:id="#+id/footerLayout"
android:layout_marginTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<Button
android:id="#+id/btnNovoAgendamentos"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="16dp"
android:background="#color/btn_default_bg"
android:text="#string/btn_send"
android:textColor="#color/btn_default"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
Its working as expected. The button is bound to parentBottom, but not to anything else. That means if the screen resizes, it will float above all other content. If you want to make it stay below, you need to add an android:layout_below to the lowest piece of content in your screen.

Android is it possible to have a part of the layout scrollable

I am trying to make an android application and I need the middle part of my screen to be scrollable. When I set a ScrollView inside an Relative Layout my application crashes.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/backgroundcolor"
android:orientation="vertical">
<TextView
android:id="#+id/tvCijferHalen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView"
android:layout_alignParentEnd="true"
android:layout_alignStart="#+id/etWegingTehalenCijfer"
android:layout_alignTop="#+id/textView"
android:layout_marginEnd="26dp"
android:layout_marginStart="20dp"
android:background="?android:attr/colorPressedHighlight"
android:paddingStart="65dp"
android:paddingTop="15dp"
android:text="0"
android:textColor="?attr/editTextColor"
android:textSize="30dp" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/etWatStaan"
android:layout_alignEnd="#+id/etWatStaan"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="328dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="20dp"
android:layout_marginTop="30dp"
android:background="#android:color/holo_green_light"
android:paddingStart="65dp"
android:paddingTop="15dp"
android:text="0"
android:textColor="?attr/editTextColor"
android:textSize="30dp" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/tvCijferHalen"
android:layout_above="#+id/etWatStaan"
android:layout_alignStart="#+id/textView"
android:layout_alignEnd="#+id/tvCijferHalen">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativelayout"
android:layout_width="fill_parent"
android:layout_height="300dp"
android:background="#color/backgroundcolor"
android:orientation="vertical">
<EditText
android:id="#+id/etcijfer1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="185dp"
android:layout_marginTop="46dp"
android:ems="10"
android:hint="Cijfer 1"
android:inputType="numberDecimal"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="visible" />
<EditText
android:id="#+id/etweging1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/etcijfer1"
android:layout_alignBottom="#+id/etcijfer1"
android:layout_alignParentStart="true"
android:layout_marginEnd="28dp"
android:layout_marginRight="46dp"
android:layout_marginStart="187dp"
android:layout_toStartOf="#+id/bLess1"
android:ems="10"
android:hint="weging"
android:inputType="numberDecimal"
android:text="1"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="visible" />
<Button
android:id="#+id/bLess1"
android:layout_width="30dp"
android:layout_height="40dp"
android:background="#android:color/transparent"
android:drawableLeft="#android:drawable/ic_delete"
android:text="Button"
android:layout_alignTop="#+id/etweging1"
android:layout_alignParentEnd="true" />
<EditText
android:id="#+id/etcijfer2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etcijfer1"
android:layout_alignParentStart="true"
android:layout_below="#+id/etcijfer1"
android:layout_marginTop="10dp"
android:ems="10"
android:hint="Cijfer 2"
android:inputType="numberDecimal"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<EditText
android:id="#+id/etweging2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etweging1"
android:layout_alignStart="#+id/etweging1"
android:layout_below="#+id/etweging1"
android:layout_marginTop="10dp"
android:layout_toStartOf="#+id/bLess2"
android:ems="10"
android:hint="weging"
android:inputType="numberDecimal"
android:text="1"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<Button
android:id="#+id/bLess2"
android:layout_width="30dp"
android:layout_height="40dp"
android:background="#android:color/transparent"
android:drawableLeft="#android:drawable/ic_delete"
android:text="Button"
android:layout_alignTop="#+id/etweging2"
android:layout_alignParentEnd="true"
android:visibility="gone"/>
<EditText
android:id="#+id/etcijfer3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etcijfer1"
android:layout_alignParentStart="true"
android:layout_below="#+id/etcijfer2"
android:layout_marginTop="10dp"
android:ems="10"
android:hint="Cijfer 3"
android:inputType="numberDecimal"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<EditText
android:id="#+id/etweging3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etweging1"
android:layout_alignStart="#+id/etweging1"
android:layout_below="#+id/etweging2"
android:layout_marginTop="10dp"
android:layout_toStartOf="#+id/bLess2"
android:ems="10"
android:hint="weging"
android:inputType="numberDecimal"
android:text="1"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<Button
android:id="#+id/bLess3"
android:layout_width="30dp"
android:layout_height="40dp"
android:background="#android:color/transparent"
android:drawableLeft="#android:drawable/ic_delete"
android:text="Button"
android:layout_alignTop="#+id/etweging3"
android:layout_alignParentEnd="true"
android:visibility="gone"/>
<EditText
android:id="#+id/etcijfer4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etcijfer1"
android:layout_alignParentStart="true"
android:layout_below="#+id/etcijfer3"
android:layout_marginTop="10dp"
android:ems="10"
android:hint="Cijfer 4"
android:inputType="numberDecimal"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<EditText
android:id="#+id/etweging4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etweging1"
android:layout_alignStart="#+id/etweging1"
android:layout_below="#+id/etweging3"
android:layout_marginTop="10dp"
android:layout_toStartOf="#+id/bLess3"
android:ems="10"
android:hint="weging"
android:inputType="numberDecimal"
android:text="1"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<Button
android:id="#+id/bLess4"
android:layout_width="30dp"
android:layout_height="40dp"
android:background="#android:color/transparent"
android:drawableLeft="#android:drawable/ic_delete"
android:text="Button"
android:layout_alignTop="#+id/etweging4"
android:layout_alignParentEnd="true"
android:visibility="gone"/>
<EditText
android:id="#+id/etcijfer5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etcijfer1"
android:layout_alignParentStart="true"
android:layout_below="#+id/etcijfer4"
android:layout_marginTop="10dp"
android:ems="10"
android:hint="Cijfer 5"
android:inputType="numberDecimal"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<EditText
android:id="#+id/etweging5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etweging1"
android:layout_alignStart="#+id/etweging1"
android:layout_below="#+id/etweging4"
android:layout_marginTop="10dp"
android:layout_toStartOf="#+id/bLess4"
android:ems="10"
android:hint="weging"
android:inputType="numberDecimal"
android:text="1"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<Button
android:id="#+id/bLess5"
android:layout_width="30dp"
android:layout_height="40dp"
android:background="#android:color/transparent"
android:drawableLeft="#android:drawable/ic_delete"
android:text="Button"
android:layout_alignTop="#+id/etweging5"
android:layout_alignParentEnd="true"
android:visibility="gone"/>
<EditText
android:id="#+id/etcijfer6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etcijfer1"
android:layout_alignParentStart="true"
android:layout_below="#+id/etcijfer5"
android:layout_marginTop="10dp"
android:ems="10"
android:hint="Cijfer 6"
android:inputType="numberDecimal"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<EditText
android:id="#+id/etweging6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etweging1"
android:layout_alignStart="#+id/etweging1"
android:layout_below="#+id/etweging5"
android:layout_marginTop="10dp"
android:layout_toStartOf="#+id/bLess5"
android:ems="10"
android:hint="weging"
android:inputType="numberDecimal"
android:text="1"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<Button
android:id="#+id/bLess6"
android:layout_width="30dp"
android:layout_height="40dp"
android:background="#android:color/transparent"
android:drawableLeft="#android:drawable/ic_delete"
android:text="Button"
android:layout_alignTop="#+id/etweging6"
android:layout_alignParentEnd="true"
android:visibility="gone"/>
<EditText
android:id="#+id/etcijfer7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etcijfer1"
android:layout_alignParentStart="true"
android:layout_below="#+id/etcijfer6"
android:layout_marginTop="10dp"
android:ems="10"
android:hint="Cijfer 7"
android:inputType="numberDecimal"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<EditText
android:id="#+id/etweging7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/etweging1"
android:layout_alignStart="#+id/etweging1"
android:layout_below="#+id/etweging6"
android:layout_marginTop="10dp"
android:layout_toStartOf="#+id/bLess6"
android:ems="10"
android:hint="weging"
android:inputType="numberDecimal"
android:text="1"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:visibility="gone" />
<Button
android:id="#+id/bLess7"
android:layout_width="30dp"
android:layout_height="40dp"
android:background="#android:color/transparent"
android:drawableLeft="#android:drawable/ic_delete"
android:text="Button"
android:layout_alignTop="#+id/etweging7"
android:layout_alignParentEnd="true"
android:visibility="gone"/>
</RelativeLayout>
</ScrollView>
<EditText
android:id="#+id/etWatStaan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/bNiewCijfer"
android:layout_alignEnd="#+id/etWegingTehalenCijfer"
android:layout_alignParentStart="true"
android:layout_marginEnd="200dp"
android:layout_marginRight="48dp"
android:ems="10"
android:hint="Wat wil je staan"
android:inputType="numberDecimal"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray" />
<EditText
android:id="#+id/etWegingTehalenCijfer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:ems="10"
android:hint="weging"
android:inputType="number"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray"
android:layout_alignBaseline="#+id/etWatStaan"
android:layout_alignBottom="#+id/etWatStaan"
android:layout_alignParentStart="true"
android:layout_marginStart="187dp" />
<Button
android:id="#+id/bNiewCijfer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:text="Cijfer Toevoegen"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView7"
android:layout_alignBottom="#+id/textView7"
android:layout_alignEnd="#+id/tvCijferHalen"
android:layout_alignStart="#+id/tvCijferHalen"
android:background="?android:attr/colorMultiSelectHighlight"
android:text="Te halen Cijfer"
android:textAlignment="center"
android:textColor="?attr/editTextColor" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView"
android:layout_alignParentTop="true"
android:layout_alignStart="#+id/textView"
android:layout_marginTop="13dp"
android:background="#android:color/holo_green_dark"
android:text="Gemiddelde"
android:textAlignment="center"
android:textColor="?attr/editTextColor" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignEnd="#+id/ScrollView01"
android:layout_alignStart="#+id/tvCijferHalen"
android:layout_marginEnd="71dp"
android:text="Weging"
android:textAlignment="center"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView"
android:layout_alignStart="#+id/ScrollView01"
android:layout_alignTop="#+id/ScrollView01"
android:layout_marginTop="31dp"
android:text="Cijfer"
android:textAlignment="center"
android:textColor="#android:color/black" />
Can someone help me ? I am wondering if it's even possible to have only a part of the screen scrollable
Try this approach:
Step 1
Use a LinearLayout as your root element to enable you to use layout_weightattribute;
Step 2
Inside your layout, you can split it into 3 parts each with a layout_weight of .3
For example:
<LinearLayout
...
orientation="vertical"
... >
<LinearLayout
layout_weight=".3"
layout_width="match_parent"
layout_height="0dp" />
<ScrollView
layout_weight=".3"
layout_width="match_parent"
layout_height="0dp" />
<LinearLayout
layout_weight=".3"
layout_width="match_parent"
layout_height="0dp" />
</LinearLayout> !-- end of root layout here
I said .3 just in case you want to have the sections occupy the same size of the window; but you can set them to whatever you want according to your needs.
I hope this helps.
Note A ScrollView only accepts ONE child element!
Good luck!

Layout changes when keyboard appears

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"

Android: RelativeLayout alignParentBottom overlaps with EditText

So I have the following Layout:
<RelativeLayout
android:id="#+id/signatureLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="20dp"
android:text="#string/Meaning"
android:textColor="#000"
android:textSize="14sp" />
<EditText
android:id="#+id/txtMeaning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView1"
android:layout_below="#+id/textView1"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp"
android:ems="10"
android:enabled="false"
android:inputType="text|textMultiLine"
android:singleLine="true"
android:textColor="#505050"
android:textSize="14sp" >
</EditText>
<TextView
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView1"
android:layout_below="#+id/txtMeaning"
android:layout_marginTop="16dp"
android:text="#string/Comments"
android:textColor="#000"
android:textSize="14sp" />
<EditText
android:id="#+id/txtSignatureComments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView01"
android:layout_below="#+id/TextView01"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="#string/Comments"
android:inputType="textMultiLine"
android:maxLength="250"
android:singleLine="false"
android:textSize="14sp" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView1"
android:layout_below="#+id/textView1"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<ImageView
android:id="#+id/ImageView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/TextView01"
android:layout_below="#+id/TextView01"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<TextView
android:id="#+id/txtDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtSignatureComments"
android:layout_marginTop="16dp"
android:text="#string/Duration2"
android:textColor="#000"
android:textSize="14sp" />
<ImageView
android:id="#+id/imgDuration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtDuration"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<EditText
android:id="#+id/txtHours"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/imgDuration"
android:layout_marginLeft="6dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="#string/Hours"
android:inputType="number|textMultiLine"
android:singleLine="true"
android:textColor="#505050"
android:textSize="14sp" >
</EditText>
<EditText
android:id="#+id/txtMinutes"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/txtHours"
android:layout_alignParentRight="true"
android:layout_marginRight="6dp"
android:ems="10"
android:hint="#string/Minutes"
android:inputType="numberDecimal|text|textMultiLine"
android:singleLine="true"
android:textColor="#505050"
android:textSize="14sp" >
</EditText>
<TextView
android:id="#+id/txtException"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtHours"
android:layout_marginTop="16dp"
android:text="#string/Exception"
android:textColor="#000"
android:textSize="14sp" />
<ImageView
android:id="#+id/imgException"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtException"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<Spinner
android:id="#+id/spnrException"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imgException"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp" />
<EditText
android:id="#+id/txtExceptionDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/spnrException"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="8dp"
android:ems="10"
android:inputType="textMultiLine"
android:maxLength="250"
android:singleLine="false"
android:textSize="14sp" >
</EditText>
<TextView
android:id="#+id/txtPerformance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtExceptionDesc"
android:layout_marginTop="16dp"
android:text="#string/PerformanceBased"
android:textColor="#000"
android:textSize="14sp" />
<ImageView
android:id="#+id/imgPerformance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtPerformance"
android:layout_marginTop="4dp"
android:contentDescription="#string/Image"
android:scaleType="fitXY"
android:src="#drawable/line2" />
<Spinner
android:id="#+id/spnrPerformance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/imgPerformance"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="16dp" />
<EditText
android:id="#+id/txtUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/spnrPerformance"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="60dp"
android:ems="10"
android:hint="#string/Username"
android:inputType="textCapCharacters|textAutoComplete"
android:singleLine="true"
android:textAllCaps="true"
android:textSize="12sp" >
</EditText>
<EditText
android:id="#+id/txtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtUsername"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="10dp"
android:ems="10"
android:hint="#string/Password"
android:inputType="textPassword"
android:singleLine="true"
android:textSize="12sp" />
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:id="#+id/btnSave"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_detail_bg"
android:text="#string/Sign"
android:textColor="#drawable/button_detail_txt"
android:textSize="16sp"
android:textStyle="bold" />
<Button
android:id="#+id/btnCancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/button_detail_bg"
android:text="#string/Cancel"
android:textColor="#drawable/button_detail_txt"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
The problem is that LinearLayout:LinearLayout1 overlaps the TextView:txtPassword when the keyboard focus is on TextView:txtPassword
LinearLayout:LinearLayout1 has android:layout_alignParentBottom="true" to keep it at the bottom but I don't know why when the focus is on TextView:txtPassword the LinearLayout:LinearLayout1 just overlaps it
I would suggest you embed the entire RelativeLayout in a ScrollView and also include android:layout_below="#+id/txtPassword" in LinearLayout1. layout_alignParentBottom="true" is not needed. I tried it out in a ScrollView and it worked fine.
You have missed out some margin alignments for the buttons (FYI).
There are 2 ways either put the relative layout in scrollview which is a good practice when your layout extends or remove the margin top from username edittext
try this:
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/txtPassword"
android:layout_alignParentBottom="true" >

Move Android Edittext little bit upwards when focus on to it

I have a multiline Edittext. When user touch it to type it shows half of it. Soft Keyboard covers the rest. I need it to be viewed fully.
This is how it shows now.
I want it to look like this.
I have used both adjustPan & adjustResize for android:windowSoftInputMode but nothing changed.
This is my XML layout.
<RelativeLayout
android:id="#+id/base"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/bg_type"
android:keepScreenOn="true"
android:orientation="vertical" >
<ImageView
android:id="#+id/own"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="120dp"
android:layout_marginTop="160dp"
android:contentDescription="#string/image"
android:src="#drawable/own" />
<ImageView
android:id="#+id/a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/own"
android:layout_marginLeft="75dp"
android:layout_toRightOf="#+id/own"
android:contentDescription="#string/image"
android:src="#drawable/a_pressed" />
<ImageView
android:id="#+id/b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/a"
android:layout_marginLeft="20dp"
android:layout_toRightOf="#+id/a"
android:contentDescription="#string/image"
android:src="#drawable/b" />
<ImageView
android:id="#+id/c"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/b"
android:layout_marginLeft="20dp"
android:layout_toRightOf="#+id/b"
android:contentDescription="#string/image"
android:src="#drawable/c" />
<FrameLayout
android:id="#+id/txtlayer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="160dp" >
<com.empite.telegramstop.Txt
android:id="#+id/txt"
style="#style/blue_edittext"
android:layout_width="820dp"
android:layout_height="200dp"
android:gravity="top"
android:imeOptions="actionNext"
android:inputType="textMultiLine"
android:nextFocusLeft="#id/txt"
android:nextFocusUp="#id/txt"
android:padding="10dp"
android:text="#string/msg_a"
android:textSize="25dp"
android:textStyle="bold"
android:typeface="monospace" >
<requestFocus />
</com.empite.telegramstop.Txt>
</FrameLayout>
<TextView
android:id="#+id/remain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/c"
android:layout_centerVertical="false"
android:layout_marginRight="-15dp"
android:layout_marginTop="325dp"
android:gravity="center"
android:text="#string/remaining"
android:textColor="#color/remain"
android:textSize="40dp"
android:textStyle="bold"
android:visibility="visible" />
<ImageView
android:id="#+id/nxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/remain"
android:layout_below="#+id/c"
android:layout_marginLeft="20dp"
android:layout_marginTop="148dp"
android:contentDescription="#string/image"
android:scaleType="center"
android:src="#drawable/bt_next" />
<RelativeLayout
android:id="#+id/RelativeLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/own"
android:layout_below="#+id/txtlayer"
android:layout_marginTop="290dp"
android:background="#drawable/panel_type_code" >
<EditText
android:id="#+id/no1"
android:layout_width="55dp"
android:layout_height="75dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="275dp"
android:layout_marginTop="18dp"
android:background="#null"
android:gravity="center"
android:imeOptions="actionDone"
android:inputType="number"
android:maxLines="1"
android:textSize="45dp"
android:textStyle="bold"
android:typeface="serif" />
<EditText
android:id="#+id/no2"
android:layout_width="55dp"
android:layout_height="75dp"
android:layout_alignBaseline="#+id/no1"
android:layout_alignBottom="#+id/no1"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/no1"
android:background="#null"
android:ems="10"
android:gravity="center"
android:imeOptions="actionDone"
android:inputType="number"
android:textSize="45dp"
android:textStyle="bold"
android:typeface="serif" />
<EditText
android:id="#+id/no3"
android:layout_width="55dp"
android:layout_height="75dp"
android:layout_alignBaseline="#+id/no2"
android:layout_alignBottom="#+id/no2"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/no2"
android:background="#null"
android:ems="10"
android:gravity="center"
android:imeOptions="actionDone"
android:inputType="number"
android:textSize="45dp"
android:textStyle="bold"
android:typeface="serif" />
<EditText
android:id="#+id/no4"
android:layout_width="55dp"
android:layout_height="75dp"
android:layout_alignBaseline="#+id/no3"
android:layout_alignBottom="#+id/no3"
android:layout_marginLeft="9dp"
android:layout_toRightOf="#+id/no3"
android:background="#null"
android:ems="10"
android:gravity="center"
android:imeOptions="actionDone"
android:inputType="number"
android:textSize="45dp"
android:textStyle="bold"
android:typeface="serif" />
<EditText
android:id="#+id/no5"
android:layout_width="55dp"
android:layout_height="75dp"
android:layout_alignBaseline="#+id/no4"
android:layout_alignBottom="#+id/no4"
android:layout_marginLeft="9dp"
android:layout_toRightOf="#+id/no4"
android:background="#null"
android:ems="10"
android:gravity="center"
android:imeOptions="actionDone"
android:inputType="number"
android:textSize="45dp"
android:textStyle="bold"
android:typeface="serif" />
<EditText
android:id="#+id/no6"
android:layout_width="55dp"
android:layout_height="75dp"
android:layout_alignBaseline="#+id/no5"
android:layout_alignBottom="#+id/no5"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/no5"
android:background="#null"
android:ems="10"
android:gravity="center"
android:imeOptions="actionDone"
android:inputType="number"
android:textSize="45dp"
android:textStyle="bold"
android:typeface="serif" />
</RelativeLayout>
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#null"
android:ems="10"
android:visibility="visible" />
</RelativeLayout>
try this may be it is use full adjust manifest
<activity
android:windowSoftInputMode="adjustResize"
android:name=".youractivity" android:label="#string/app_name" >
and see this move up text view only when virtual keyboard open on android
use the EditText's setOnFocusChangeListener() method, and change the layout accordingly.
Try to add a ScrollView before your root RelativeLayout, and delete the android:windowSoftInputMode from your manifest.

Categories

Resources