【问题标题】:How to remove extra spaces on softkeyboard如何删除软键盘上的多余空格
【发布时间】:2013-05-02 04:26:21
【问题描述】:

我想知道如何删除软键盘的顶部空格/边距。


为了更清晰的图片,请查看以下屏幕截图:

有空格和无空格:

【问题讨论】:

  • 您的用户名和密码字段的输入类型是什么?
  • @MCeley 好的,我想我明白你的意思了 :) 我将重新配置 EditText 选项。感谢指导!

标签: android margin android-softkeyboard


【解决方案1】:

您看到的“间距”是自动完成建议区域。如果您将输入类型设置为像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" 作为您的密码字段。

【讨论】:

  • +1 @MCeley 很棒的信息!我很确定其他人会从您的回答中受益:)
【解决方案2】:

无论您的inputType 是什么,请在其末尾添加|textNoSuggestions

【讨论】:

  • +1 那就是答案 :) 我怎么会忘记这个,谢谢@kcoppock
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-17
  • 2019-03-03
  • 2011-04-28
  • 2016-05-19
  • 2012-01-24
  • 1970-01-01
相关资源
最近更新 更多