android soft keyboard spoils layout when appears

前端 未结 3 1632
感动是毒
感动是毒 2021-02-13 17:05

Here is a layout:



        
相关标签:
3条回答
  • 2021-02-13 17:35

    I think it is because of the LinearLayout that you are using. Can you please change your inner layout with relative layout? In your current situation, keyboard just changes the margins between components because of the linear layout. And change your config with adjustNothing.

    0 讨论(0)
  • 2021-02-13 17:37

    Since the input is coming into an EditText of yours, it's always going to move something.

    Consider having two layouts, one for when the keyboard is down, one for when the keyboard is up.

    Using a ViewSwitcher may help with that.

    0 讨论(0)
  • 2021-02-13 17:48

    you must use <ScrollView> as main layout. example:

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="match_parent"
       android:layout_height="match_parent">
       ....
    </ScrollView>
    

    or use this code in AndroidManiFest.xml:

    <activity
         android:windowSoftInputMode="adjustNothing">
    </activity>
    
    0 讨论(0)
提交回复
热议问题