我想知道如何删除软键盘的top 空格/边距。
为了更清晰的图片,请查看以下屏幕截图:
有空格和无空格:
最佳答案
您看到的“间距”是自动完成建议区域。如果您将输入类型设置为像 text
这样简单的类型,那么您将从键盘获得建议。添加textNoSuggestions
到您的 inputType
字段将删除建议区域。
例如:
<EditText android:id="@+id/username_field"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textNoSuggestions"
android:hint="@string/username" />
或者,如果您已经在使用类似 textCapWords
的东西,您可以像这样组合它们:
<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"
。
关于android - 如何删除软键盘上的多余空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16432230/