layout of the screen moves up when keyboard is displayed

后端 未结 6 1169
旧巷少年郎
旧巷少年郎 2020-12-06 04:56

Let say I have the following layout:

when I click on the edit text at the bottom I get this:

As you can notice the image from the top goe

相关标签:
6条回答
  • 2020-12-06 05:05

    well, I have not mentioned any "windowSoftInputMode" in my app's manifest and it runs fine. Screen does not move up when the keyboard opens up. Try this approach - just remove the "windowSoftInputMode" parameter from your manifest .

    0 讨论(0)
  • 2020-12-06 05:08

    Try this, for me it worked...

    <CoordinatorLayout
    android:fitsSystemWindows="true">
    <AppBarLayout>
        <Toobar>
            <!--...-->
        </Toobar>
    </AppBarLayout>
    <include layout="@layout/content_main_message" /> <!--EditText here-->
    </CoordinatorLayout>
    
    0 讨论(0)
  • 2020-12-06 05:15

    Try this:

    android:windowSoftInputMode="adjustNothing"
    
    0 讨论(0)
  • 2020-12-06 05:16

    Try using

    android:windowSoftInputMode="adjustPan|adjustResize"
    

    for the activity.

    0 讨论(0)
  • 2020-12-06 05:19

    I already had a windowsoftInputMode to prevent the keyboard from opening, so just add the comment code

    android:windowSoftInputMode="stateHidden|adjustPan|adjustResize"

    0 讨论(0)
  • 2020-12-06 05:25

    My EditText kept moving up as well.

    Adding gravity to the Edit Text seems to solve the problem. The Keyboard was pushing my EditText up, so I added gravity to the bottom of the Edit Text in the XML.

    android:gravity=bottom
    
    0 讨论(0)
提交回复
热议问题