Move Android Edittext little bit upwards when focus on to it - android

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.

Related

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!

Android weight property error in layout

I have 5 horizontal linear layout is there. I aligned three edittext in a single linear layout. And I applied the weight field property 1 for all the editext. But in 1st and 3rd linear layout working perfectly with the property. Others are not working properly. Again in 5th horizontal linear layout have one spinner view, it was also creating the same problem. Then 4th line one addition linear layout available inside the horizontal layout, with one edittext and one imageview. It is also not fixing properly with weight property. I put layout code below.
<?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" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_horizontal">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/yellow" />
<TextView
android:id="#+id/sign_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Sign Up" />
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="#+id/f_name"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLength="20"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="textPersonName"
android:layout_marginRight="20dp"
android:hint="First Name"
android:background="#drawable/edittext_yellow_singleline" >
</EditText>
<EditText
android:id="#+id/l_name"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLength="20"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="textPersonName"
android:layout_marginRight="20dp"
android:hint="Last Name"
android:background="#drawable/edittext_yellow_singleline" />
<EditText
android:id="#+id/uname"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLength="20"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="textPersonName"
android:hint="Username *"
android:background="#drawable/edittext_yellow_singleline" />
</LinearLayout>
<Space
android:layout_width="wrap_content"
android:layout_height="10dp"/>
<LinearLayout//this layout creating alignment issue. if I put extra space in hint nearly it was getting good view. But different screens wont work
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="#+id/phone"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLength="12"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="phone"
android:layout_marginRight="20dp"
android:hint="Phone"
android:background="#drawable/edittext_yellow_singleline" />
<EditText
android:id="#+id/plan_id"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="textPostalAddress"
android:layout_marginRight="20dp"
android:hint="Member Plan ID"
android:background="#drawable/edittext_yellow_singleline" />
<EditText
android:id="#+id/pass"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLength="20"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="textPassword"
android:hint="Password *"
android:background="#drawable/edittext_yellow_singleline" />
</LinearLayout>
<Space
android:layout_width="wrap_content"
android:layout_height="10dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="#+id/address"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLength="50"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="textPostalAddress"
android:layout_marginRight="20dp"
android:hint="Address"
android:background="#drawable/edittext_yellow_singleline" />
<EditText
android:id="#+id/mobile"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLength="10"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="phone"
android:layout_marginRight="20dp"
android:hint="Mobile * "
android:background="#drawable/edittext_yellow_singleline" />
<EditText
android:id="#+id/email"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLength="30"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="textEmailAddress"
android:hint="Email * "
android:background="#drawable/edittext_yellow_singleline" />
</LinearLayout>
<Space
android:layout_width="wrap_content"
android:layout_height="10dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="#+id/city"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLength="30"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="textPostalAddress"
android:layout_marginRight="20dp"
android:hint="City"
android:background="#drawable/edittext_yellow_singleline" />
<EditText
android:id="#+id/state"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLength="30"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="textPostalAddress"
android:layout_marginRight="20dp"
android:hint="State"
android:background="#drawable/edittext_yellow_singleline" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1">//tried this not worked
<EditText
android:id="#+id/dob"
android:layout_width="265dp"
android:layout_height="40dp"
android:maxLength="10"
android:textSize="18dp"
android:inputType="date"
android:hint="Date of Birth"
android:background="#drawable/edittext_yellow_singleline" />
<ImageButton
android:id="#+id/img_dob"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="#drawable/cal" />
</LinearLayout>
</LinearLayout>
<Space
android:layout_width="wrap_content"
android:layout_height="10dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="#+id/country"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="textPostalAddress"
android:layout_marginRight="20dp"
android:hint="Country"
android:background="#drawable/edittext_yellow_singleline" />
<EditText
android:id="#+id/zipcode"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLength="6"
android:textSize="18dp"
android:layout_weight="1"
android:inputType="number"
android:layout_marginRight="20dp"
android:hint="Zipcode "
android:background="#drawable/edittext_yellow_singleline" />
<Spinner
android:id="#+id/gender"
android:layout_width="305dp"//finally hard coded but it wont work for multiple screens
android:layout_height="40dp"
/>
</LinearLayout>
<Space
android:layout_width="wrap_content"
android:layout_height="30dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="#+id/ok"
android:layout_width="100dp"
android:layout_height="40dp"
android:gravity="center"
android:textSize="20dp"
android:text="Done"
android:background="#drawable/login_button_shape" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
If it won't work means, will the table layout give solution for this?
If I reduce the text inside the hint then also it was working fine in 2nd line. If I provide space for keeping same text length in with other edittext field which contains low text also not worked.
All your EditText should have:
android:layout_width="0dp"
And all LinearLayout should have:
android:weightsum="3"

EditText Field not working good when run the app

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>

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" >

android softkeyboard pushes layout up

So basically i have a main layout which is a log in screen. The problem is that whole Relative-layout goes off the screen when i tap onto Edittext field...
Here is my xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/background_gradient"
android:theme="#android:style/Theme.NoTitleBar"
tools:context=".MainActivity" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/editText1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="60dp"
android:baselineAlignBottom="true"
android:contentDescription="#string/skedo"
android:src="#drawable/logo" />
<EditText
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_above="#+id/editText2"
android:layout_centerHorizontal="true"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:drawableLeft="#drawable/user"
android:drawablePadding="13dp"
android:paddingLeft="13dp"
android:inputType="textEmailAddress"
android:background="#drawable/round_corners"
android:ems="10"
android:hint="#string/email" />
<EditText
android:id="#+id/editText2"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:layout_marginTop="8dp"
android:drawableLeft="#drawable/lock"
android:drawablePadding="13dp"
android:paddingLeft="13dp"
android:background="#drawable/round_corners"
android:ems="10"
android:hint="#string/password"
android:inputType="textPassword" >
</EditText>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText2"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:textSize="17sp"
android:shadowColor="#000000"
android:shadowRadius="1"
android:shadowDx="0"
android:shadowDy="1"
android:text="#string/login"
android:textColor="#ffffff"
android:background="#drawable/button_states" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/button1"
android:layout_centerInParent="true"
android:layout_marginTop="23dp"
android:clickable="true"
android:text="#string/forgot_password"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="13sp" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="23dp"
android:contentDescription="#string/imgdesc"
android:src="#drawable/or" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView2"
android:shadowColor="#ffffff"
android:shadowRadius="1"
android:shadowDx="0"
android:textSize="14sp"
android:textStyle="bold"
android:shadowDy="1"
android:layout_centerHorizontal="true"
android:layout_marginTop="23dp"
android:text="#string/register"
android:background="#drawable/create_account"
/>
So when this happens my logo disappears off the screen and i would like it to be showing. The best example would be facebook log in screen, where when you tap on editText it squashes everything and logo is still visible. So how can i achieve such effect?
So when nothing is pressed:
http://postimage.org/image/swdtggnil/
When keyboard appears
http://postimage.org/image/5pbdfrftl/
I want it to behave exactly like that.
If I have not misunderstood you can add
android:windowSoftInputMode="adjustPan"
in the AndroidManifest.xml
<activity
android:name="yourActivity"
android:windowSoftInputMode="adjustPan" >
</activity>

Categories

Resources