【问题标题】:Hide/ Disable mic option from android soft keyboard从 android 软键盘隐藏/禁用麦克风选项
【发布时间】:2019-03-15 06:36:44
【问题描述】:

我想在当前应用程序的软键盘上隐藏麦克风。

我已经尝试了这些可能的解决方案。

Disable speech to text button (Micro phone) on soft input keyboard in android programmatically

但是这个解决方案根本不起作用。

我发现了一件意想不到的事情,当添加 inputType = “textFilter” 然后它对我有用,我的意思是麦克风被隐藏了。

但如果可能的话,我希望得到问题的确切解决方案,因为如果我采用提到的“textFilter”东西,那么以后它可能会崩溃。

我在以下 OS 上试过。版本

  1. 饼图(API-28),设备 - Pixel2XL
  2. 棉花糖 (API-23),设备 - MotoE3Power

【问题讨论】:

    标签: android android-layout android-softkeyboard


    【解决方案1】:

    您还可以在 XML 中定义 android:privateImeOptions="nm" 其中 nm = [无麦克风]

    <AutoCompleteTextView
                            android:id="@+id/email"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:privateImeOptions="nm" />
    

    【讨论】:

    • 我检查了你提到的两个 API 级别
    • 我认为这两种解决方案都适用于三星,但不适用于我提到的摩托罗拉和 Google Pixel 设备。
    • 也为我工作。三星 Note 9
    猜你喜欢
    • 1970-01-01
    • 2018-01-29
    • 2018-05-11
    • 1970-01-01
    • 2022-12-14
    • 2011-02-17
    • 1970-01-01
    • 2014-04-07
    • 1970-01-01
    相关资源
    最近更新 更多