Reputation: 535
I am trying to do following Design
My XML Code is as follow
<?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="fill_parent"
android:layout_gravity="fill_vertical" >
<EditText
android:id="@+id/patientid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="20dp"
android:layout_marginTop="50dp"
android:layout_toLeftOf="@+id/speak"
android:ems="10"
android:hint="@string/patientidhint" >
<requestFocus />
</EditText>
<Button
android:id="@+id/speak"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/patientid"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:onClick="speak"
android:text="@string/speak"
tools:context=".CreatingPatientFolder"
/>
<ListView
android:id="@+id/lvTextMatches"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/speak"
android:layout_above="@+id/btn_Submit"/>
<Button
android:id="@+id/btn_Submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:layout_alignParentBottom="true"
android:gravity="center"
android:paddingBottom="10dp"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:paddingTop="10dp"
android:text="Submit"
android:textSize="20sp"
tools:ignore="HardcodedText" />
</RelativeLayout>
Now when I run this project it gets displayed as follow
So can any one please tell me why my button is getting shift upwards also please help me to remove this issue.
Upvotes: 1
Views: 2498
Reputation: 1985
One More thing that helped me was the change of theme in the Manifest file to NoActionBar and FullScreen (In case you don't want to use the ActionBar like me).
android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen"
Upvotes: 0
Reputation: 364
I think the reason why the button is moved is because your list is empty, you have enough room to move the button and the button is not bellow the edit text, therefore it can overlap it.
There is a property in your manifest called "windowSoftInputMode". This property specifies how the soft keyboard should behave.
You could use:
android:windowSoftInputMode="stateVisible|adjustNothing
Upvotes: 2
Reputation: 1144
android:layout_marginTop="20dp"
i did not test . May be Solve your problem.
Upvotes: 0