I got this code below is my main.xml
<?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:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/textView1"
android:layout_alignParentLeft="true"
android:layout_marginBottom="80dp"
android:paddingTop="10dp"
android:text="@string/parameter"
android:textColor="@color/White"
android:textSize="18sp" />
<Spinner
android:id="@+id/spinner1"
style="@layout/spinner_layout"
android:layout_width="120dp"
android:layout_height="55dp"
android:layout_alignLeft="@+id/spinner3"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="22dp"
android:paddingLeft="5dp"
tools:listitem="@android:layout/simple_list_item_1" />
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/spinner1"
android:layout_alignBottom="@+id/spinner1"
android:layout_alignLeft="@+id/output2"
android:layout_alignParentRight="true"
android:ems="10"
android:inputType="numberDecimal" >
<requestFocus />
</EditText>
<Spinner
android:id="@+id/spinner3"
android:layout_width="120dp"
android:layout_height="55dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="320dp"
android:layout_toRightOf="@+id/textView7" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/textView7"
android:layout_alignParentLeft="true"
android:layout_marginBottom="80dp"
android:text="@string/transmission"
android:textColor="@color/White"
android:textSize="18sp" />
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView1"
android:layout_alignBottom="@+id/textView1"
android:layout_alignLeft="@+id/EditText1"
android:layout_alignRight="@+id/EditText1"
android:ems="10"
android:inputType="numberDecimal"
android:text="70" />
<EditText
android:id="@+id/EditText1"
android:layout_width="120dp"
android:layout_height="55dp"
android:layout_above="@id/editText2"
android:layout_alignParentRight="true"
android:layout_marginBottom="50dp"
android:ems="10"
android:hint="@string/uren"
android:inputType="number|numberDecimal" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/spinner3"
android:text="@string/out"
android:textColor="@color/White"
android:textSize="18sp" />
<TextView
android:id="@+id/output2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView7"
android:layout_alignBottom="@+id/textView7"
android:layout_alignLeft="@+id/EditText1"
android:layout_alignParentRight="true"
android:background="@drawable/box"
android:paddingTop="10dp"
android:text="@string/textview"
android:textSize="18sp" />
<Spinner
android:id="@+id/spinner2"
style="@layout/spinner_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/textView1"
android:layout_marginBottom="80dp"
android:layout_marginLeft="20dp"
android:layout_toLeftOf="@+id/EditText1"
android:layout_toRightOf="@id/textView2" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/editText1"
android:text="@string/in"
android:textColor="@color/White"
android:textSize="18sp" />
</RelativeLayout>
What I want is when the keyboard pops up, to remove or decrease the margins, so that everything will stay visible in the top half of the screen (since half below is used by keyboard. And when keyboard goes away, then I want everything back to normal.
Struggling for 2 hour now, so not going to post everything I tried...
I got android:windowSoftInputMode="adjustResize"
in the manifest.
What happens now: When keyboard comes up, it puts up the rest up too (so the bottom half is on top half, and top half is outside the screen). But I want to decrease the margins, so everything stays on top half. Is this possible?
And could you help me along to achieve this.