<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/editTextTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/task_title"
android:ems="10" >
<requestFocus />
</EditText>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/buttonSeven"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="7" />
</RelativeLayout>
Trying to align a few buttons at the bottom of the screen. However when the keyboard pops up, I want the buttons to move up to above the keyboard. How to do that?
Make the Parent of the LinearLayout containing the button as relative and set the property of linear layout containing two buttons as android:layout_alignParentBottom="true". You can also set the gravity of the Linear Layout to Bottom.
If you have a single Button in your Activity and you want to center it the simplest way is to use a RelativeLayout and set the android:layout_centerInParent=”true” property on the Button.
After research I figured out that to work in some cases parent layout has to be set android:fitsSystemWindows="true" . Then native functionality of scrolling EditText above scrollbar working like a charm. Show activity on this post. Simply setting android:fitsSystemWindows="true" in the layout xml worked for me.
In your AndroidManifest.xml just add this attribute: android:windowSoftInputMode="adjustResize"
<activity
android:windowSoftInputMode="adjustResize"
android:name="com.example.stackoverflow.SimpleActivity5" >
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With