Android Toolbar moves up when keyboard appears

The problem was that I was using <item name="android:windowTranslucentStatus">true</item> in styles.xml

To enable adjustResize add android:fitsSystemWindows="true" in your activity's parent layout


In my case, my default application was using Coordinator Layout for the root element. Even doing what was described above wasn't solving my problem. Then I did the following:

  1. Changed the root layout from Coordinator Layout to RelativeLayout
  2. Included android:fitsSystemWindows="true" to the root layout
  3. Included android:windowSoftInputMode="adjustResize|stateAlwaysHidden" to the activity manifest tag.

Or add this line in manifest. android:windowSoftInputMode="adjustResize"


If you don't want your Toolbar to be pushed up, you shouldn't be using adjustPan. Using adjustResize without any other things (without adding any additional Views) should be enough.