Shazeen
Shazeen

Reputation: 5

Bottom button moves up when keyboard opens

There is a scrollview & button(at the bottom) inside linear layout. Toolbar is fixed for the screen. When keyboard opens, button moves up. I want the button not to move up.

Upvotes: 0

Views: 5237

Answers (5)

ViramP
ViramP

Reputation: 1709

Here issue with manifest property for that activity.

Have you added any property at manifest like below ?

 android:windowSoftInputMode="adjustPan"

Or

 android:windowSoftInputMode="adjustResize"

Upvotes: 0

LvN
LvN

Reputation: 711

Make sure your activity has the following attribute in your AndroidManifest.xml

android:windowSoftInputMode="adjustResize"

Also in the layout xml file has LinearLayout as the parent for Button and EditText.

Upvotes: 0

Andolasoft Inc
Andolasoft Inc

Reputation: 1296

Use the below code to change the your manifest.xml ,,For which xml layout contains activity.

android:windowSoftInputMode="stateUnchanged|adjustResize"

OR

android:windowSoftInputMode="adjustPan|adjustResize"

Change in MANIFEST FILE

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.adjustscroll.MainActivity"
        android:label="@string/app_name"
        android:windowSoftInputMode="stateUnchanged|adjustResize"
         >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

Hope this will help you. Let me know if solved.

Upvotes: 1

kgandroid
kgandroid

Reputation: 5595

If you are using Fragment write the below code in onCreateView:

getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

Upvotes: 1

cake double
cake double

Reputation: 60

In your XML file, you can use ScrollView:

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!--your layout-->

</ScrollView>

Upvotes: 0

Related Questions