Keyboard above EditText on second click

This image:

enter image description here

When I first click on the "Confirm password" EditText, it works as it should - the layout pops up, so I can enter the text in the selected EditText, but when I dismiss the keyboard (this EditText is still focused) and click on the same EditText again , it will remain under the keyboard.

The main layout is RelativeLayout, the input fields are in the ScrollView, and the buttons are in the LinearLayout, aligned with the parent bottom.

In the manifest, I have android:windowSoftInputMode="adjustPan" .

Is this some kind of problem with Android, or am I doing something wrong?

+5
source share
2 answers

This is actually a bug in EditText . try removing the EditText gravity, which can be either center_horizontal or center

Got an answer from another question. check this one out .

+4
source

I just came up with a workaround for this problem, I got my edit text to start the text in the middle of the screen with a not-so-good solution, but it works for me. This code is:

  <EditText android:layout_width="match_parent" android:layout_height="0dp" android:paddingStart="130sp" android:paddingEnd="50sp" android:descendantFocusability="beforeDescendants" android:focusableInTouchMode="true" android:gravity="bottom"/> 
0
source

Source: https://habr.com/ru/post/1208133/


All Articles