2

I have an EditText visible in a LinearLayout that I don't want to move when the soft keyboard is shown. The reason I don't want it to move is because I want to control the items above and adjust their sizes to make the EditText and the content it controls below to become visible.

Is it possible to prevent the screen moving at all once the soft keyboard is shown?

Note: I am using an activity with the toolbar hidden.

Chris Merron
  • 99
  • 1
  • 11
  • Place your code and layout xml as well. – Abhishek May 18 '18 at 07:26
  • Possible duplicate of [Android: How do I prevent the soft keyboard from pushing my view up?](https://stackoverflow.com/questions/4207880/android-how-do-i-prevent-the-soft-keyboard-from-pushing-my-view-up) – Abhishek May 18 '18 at 08:41

2 Answers2

1

I have solved this - I have added the SetSoftInputMode to AdjustNothing to the OnCreate method. Doing this in the xml doesn't do anything, but in the code does.

Chris Merron
  • 99
  • 1
  • 11
0

In your AndroidManifest.xml file, go to your activity and add this.

<activity
        ...
        android:windowSoftInputMode="adjustNothing"
    />

your views will remain in the same position

Naveen T P
  • 6,955
  • 2
  • 22
  • 29
Soropromo
  • 1,212
  • 12
  • 17