How to remove extra spaces on softkeyboard

廉价感情. 提交于 2019-12-11 03:43:18

问题


I would like to know how to remove the top space/margin of a soft-keyboard.


For clearer picture, checkout the following screenshots:

With space and without space:


回答1:


The "spacing" you're seeing is the autocomplete suggestion area. If you have an input type set to something as simple as text then you're going to get suggestions from the keyboard. Adding textNoSuggestions to your inputType field will remove the suggestions area.

So for example:

<EditText android:id="@+id/username_field"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:inputType="textNoSuggestions"
    android:hint="@string/username" />

Or if you were already using something like textCapWords you can combine them like so:

<EditText android:id="@+id/username_field"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:inputType="textCapWords|textNoSuggestions"
    android:hint="@string/username" />

Also, not sure if you are using it but just a heads up, you'll want to use inputType="password" for your password field.




回答2:


Whatever your inputType is, add |textNoSuggestions to the end of it.



来源:https://stackoverflow.com/questions/16432230/how-to-remove-extra-spaces-on-softkeyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!