Android:尽管使用了 maxLines 和 inputType,但 imeOptions 不起作用

Android: imeOptions doesn't work despite using maxLines and inputType

我希望我的应用程序中的软键盘在单击特定 EditText 时显示 Done。这是它的样子

<EditText
     android:id="@+id/code_editText"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_below="@id/enter_code_textView"
     android:layout_marginStart="@dimen/margin_25dp"
     android:layout_marginLeft="@dimen/margin_25dp"
     android:layout_marginTop="@dimen/margin_12dp"
     android:layout_marginEnd="@dimen/margin_25dp"
     android:layout_marginRight="@dimen/margin_25dp"
     android:background="@drawable/edittext_background"
     android:maxLines="1"
     android:inputType="text"
     android:imeOptions="actionDone"
     android:textColor="@color/black"
     android:textCursorDrawable="@null"
     android:textSize="16sp" />

但这行不通。软键盘输入键文本根本没有改变。我在多台设备上试过这个,一台 Oreo 和一台 KitKat。我也尝试使用 singleLine 属性,但这也不起作用。我在这里错过了什么?提前致谢!

无法强制软键盘显示任何键,即使是 imeOptions。键盘应用程序将其用作提示 - 它不必遵守它。请记住,每个不同的键盘都会对是否尊重它做出不同的选择。而且没有像 "default keyboard" 这样的东西,因为许多 OEM 都在替换它。基本上,您可以设置 imeOptions 并希望它起作用,但无法强制它在所有设备和键盘应用程序上起作用。