Android adjustpan not working after the first time

前端 未结 8 917
生来不讨喜
生来不讨喜 2020-12-01 05:55

My problem: starting from the second time the software keyboard is shown on the screen, it entirely hides my EditText.

Attribute android:windowSoftInputMode=\"adjus

8条回答
  •  清歌不尽
    2020-12-01 06:32

    Here is the code I was originally using that ran into this problem:

        
    

    When I removed the center gravity line from the EditText, the panning worked:

    android:gravity="center"
    

    I worked around it by wrapping the EditText in a FrameLayout and centering the entire EditText in the FrameLayout. The one issue it causes is that the EditText will be at least the width of the hinttext, so the first few characters/words typed won't be centered. This was fine for me but your mileage may vary :)

    
    
        
    
    

    EDIT: this workaround breaks if the user is clicking on the very last word in the edittext. I'm now using the onKeyPreIme workaround

提交回复
热议问题