如何让键盘显示返回键?

时间:2012-10-18 01:19:04

标签: android keyboard return

我想我已尝试过各种组合,但我无法使用alpha键盘来显示返回键。它总是一个“完成”按钮,这是没用的。在Nexus 7(4.1)上,它更糟糕,并显示一个愚蠢的笑脸按钮和完成按钮,这对我的应用程序没有任何意义。只要我有一个返回按钮,就可以有一个完成按钮。这是我尝试过的众多选择之一:

<AutoCompleteTextView
    android:id="@+id/annotate_edit"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="15dp"
    android:layout_marginLeft="60dp"
    android:layout_marginRight="60dp"
    android:layout_marginTop="15dp"
    android:completionThreshold="1"
    android:inputType="textCapSentences|textImeMultiLine"
    android:imeOptions="actionDone"
    android:lines="1"
    android:maxLength="18"
    android:textSize="30px" />

我尝试过使用和不使用imeOpitons系列,以及各种inputType选项,包括删除它。有一些选项可以使它成为搜索按钮(没有帮助),但没有列出使其成为返回键。我也试过“lines = 2”,但没有解决它。还有其他想法吗?

1 个答案:

答案 0 :(得分:4)

现在你已经设置了imeOptions="actionDone"。你说你已经尝试删除它,但所有这一切都将其默认为actionDone,每the docs.

尝试设置imeOptions="actionNone"。这应该不会给你任何动作并强制返回键。

我不知道这本身就能保证工作的多行AutoCompleteTextView。我在一个应用程序中有一个,它在我的所有设备上显示一个返回键。区别在于返回键的行为。

例如,在我的GNex(4.1)上,当你按下返回时它正确换行。

在我的SGS2(2.3)上,按下它时没有任何反应。没有多行,没有完成。只是一个死按钮。

可能是不同API中默认EditText样式的差异,因此您还应尝试设置inputType="textMultiLine"。这与textImeMultiLine之间可能存在细微差别。