Space between keyboard and EditText in Android

后端 未结 3 1930
有刺的猬
有刺的猬 2021-02-11 16:00

Soft input mode is \"SOFT_INPUT_ADJUST_PAN\", and when keyboard shown, EditText moves up to stay visible, but the keyboard and txt\'s bottom are always

相关标签:
3条回答
  • 2021-02-11 16:18

    I applied above methods which worked for me was Set android:windowSoftInputMode on the Activity to "adjustPan" than i added the padding to the edittext with gravity bottom and it works like charm. Thanks,

    0 讨论(0)
  • 2021-02-11 16:32

    Why don't you try this?

    android:windowSoftInputMode="adjustResize"
    

    I know you want to adjust pan but this would solve your problem aswell.

    Since you really want to stay with adjustPan, maybe you can try re-designing the XML layout a little bit.

    You must also add your required padding to the outer most container element in the layout file.

    0 讨论(0)
  • 2021-02-11 16:33

    May this help you:

    If this line is written in your code then remove it:

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    

    OR:

    You should not be setting your layout_width and layout_heights with explicit pixel values. Instead, use wrap_parent or fill_parent as appropriate.

    OR:

    If you have set your minSdkVersion to 3 then change it to minSdkVersion=4

    Edit:

    Set android:windowSoftInputMode on the Activity to "adjustPan"

    OR:

    Add this code in your main activity in setOnTouchListener() of your EditText:

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED);
    
    0 讨论(0)
提交回复
热议问题