如何在软键盘上删除多余的空格
我想知道如何删除软键盘的 top 空间/边距.
I would like to know how to remove the top space/margin of a soft-keyboard.
要获得更清晰的图片,请查看以下屏幕截图:
For clearer picture, checkout the following screenshots:
有空格但无空格:
您看到的间隔"是自动填充建议区域.如果您将输入类型设置为像text
这样简单的内容,那么您将从键盘上获得建议.在inputType
字段中添加 textNoSuggestions
将会删除建议区域.
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.
例如:
<EditText android:id="@+id/username_field"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textNoSuggestions"
android:hint="@string/username" />
或者如果您已经在使用textCapWords
之类的东西,则可以将它们组合如下:
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" />
此外,不确定是否正在使用它,而只是一个提示,您将需要在密码字段中使用inputType="password"
.
Also, not sure if you are using it but just a heads up, you'll want to use inputType="password"
for your password field.