Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Space between keyboard and EditText in Android

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 sticked together as seen on screenshot, I want some space between them, is it possible?

Also input mode must stay as "SOFT_INPUT_ADJUST_PAN".

Sorry form my english, Thanks in Advance...

Screenshot:

like image 277
Altynbek Usenbekov Avatar asked Jul 13 '13 12:07

Altynbek Usenbekov


2 Answers

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);
like image 175
Bhavin Nattar Avatar answered Nov 05 '22 09:11

Bhavin Nattar


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,

like image 30
Dhiraj Himani Avatar answered Nov 05 '22 08:11

Dhiraj Himani