Gaurav Singhal
Gaurav Singhal

Reputation: 189

Android:Bottom view should not appear above keyboard When soft keyboard open But Scroll should work. How to achieve?

I am using a Relative layout as root view and i have a view in bottom. When i am opening keyboard my View goes up and then i use

<activity
 android:windowSoftInputMode="adjustPan"> 
 </activity>

View that need to be in bottom

After doing this my View is not showing up but Still my content is not scrolling up, it's behind the screen. I want to scroll my content till the bottom How to achieve it? Please help me.

Scroll the view after keyboard open

Upvotes: 4

Views: 1805

Answers (3)

Giteeka Sawlani
Giteeka Sawlani

Reputation: 465

try this

android:windowSoftInputMode="adjustResize"

And if you are using full screen activity then nothing will work.

Upvotes: 1

Saurabh Vardani
Saurabh Vardani

Reputation: 1861

Do like this...(Tested)

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

        <RelativeLayout
            android:id="@+id/footer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:gravity="center">
           //define you bottom view here
        </RelativeLayout>

        <ScrollView
            android:id="@+id/scrollableContents"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:isScrollContainer="false"
            android:layout_above="@id/footer">

            //Rest of the view except bottom view
        </ScrollView>
    </RelativeLayout>

And in manifest define

android:windowSoftInputMode="stateVisible|adjustPan"

This code is working great for me.

Upvotes: 0

himanshu1496
himanshu1496

Reputation: 1921

Try including your layout inside a ScrollView, it will allow you to scroll when keyboard is open.

Upvotes: 0

Related Questions