0

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.

Shazeen
  • 5
  • 1
  • 1

5 Answers5

1

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

getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
kgandroid
  • 5,507
  • 5
  • 39
  • 69
1

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.

V-rund Puro-hit
  • 5,518
  • 9
  • 31
  • 50
Andolasoft Inc
  • 1,296
  • 1
  • 7
  • 16
  • this is right done by using android:windowSoftInputMode="adjustPan|adjustResize" ,, thanks – Zain Apr 13 '19 at 15:48
  • adjustPan is working but it will restrict scroll!! @Zain – Arnold Brown Feb 08 '20 at 08:57
  • @ArnoldBrown I guess I have trouble with that.. Can you please check in [here](https://stackoverflow.com/questions/59492019/making-the-whole-layout-smaller-when-the-keyboard-appears/59492293#59492293) – Zain Feb 08 '20 at 12:59
0

In your XML file, you can use ScrollView:

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

    <!--your layout-->

</ScrollView>
0

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.

LvN
  • 701
  • 1
  • 6
  • 22
0

Here issue with manifest property for that activity.

Have you added any property at manifest like below ?

 android:windowSoftInputMode="adjustPan"

Or

 android:windowSoftInputMode="adjustResize"
ViramP
  • 1,659
  • 11
  • 11