【问题标题】:Android: imeOptions doesn't work despite using maxLines and inputTypeAndroid:imeOptions 不起作用,尽管使用了 maxLines 和 inputType
【发布时间】:2019-09-21 15:36:56
【问题描述】:

我希望我的应用程序中的软键盘在单击特定的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 属性,但这也不起作用。我在这里想念什么?提前致谢!

【问题讨论】:

    标签: android android-edittext imeoptions


    【解决方案1】:

    没有办法强制软键盘显示任何键,甚至是 imeOptions。键盘应用程序使用它作为提示 - 它不必尊重它。请记住,每个不同的键盘都会对是否尊重它做出不同的选择。并且没有“默认键盘”之类的东西,因为许多 OEM 都替换了它。基本上,您可以设置 imeOptions 并希望它能正常工作,但没有办法强制它在所有设备和键盘应用程序上工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多