How to move the layout up when the soft keyboard is shown Android?

Estimated read time 1 min read

Sometimes, you need to change the layout when the soft keyboard appeared on the screen. You can fix this by adding a line of code into the AndroidManifest.xml file within the relevant activity section.

android:windowSoftInputMode="adjustResize"

Add this code to the activity.

<activity
            android:name=".MainActivity"
            android:exported="true"
            android:screenOrientation="fullSensor"
            android:theme="@style/NoActionBarTheme"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

The author shares useful content compiled in the field of informatics and technology on this blog.