简体   繁体   English

隐藏麦克风按钮Android虚拟键盘

[英]Hide microphone button Android virtual keyboard

I wanted to know if is it possible to hide the microphone button (speech-to-text) in Android Virtual Keyboard programatically. 我想知道是否可以以编程方式隐藏Android虚拟键盘中的麦克风按钮(语音到文本)。

I know I can disable this option through device settings, but I don't want the user to use this feature in my application independently of his/her settings. 我知道我可以通过设备设置禁用此选项,但我不希望用户在我的应用程序中独立于他/她的设置使用此功能。 I mean i want to force this behaviour inside my app. 我的意思是我想在我的应用程序中强制这种行为。

Thanks in advance, Demian 提前谢谢,德米安

这是你如何做到的:android:privateImeOptions =“nm” - nm代表没有麦克风。

You can't force the user input through anything other than pre-defined keyboards that already exist in the user's device. 您不能通过用户设备中已存在的预定义键盘以外的任何其他方式强制用户输入。

The only way you could get around this is by programming your own custom, on-the-fly keyboard, and that is a very bad idea. 解决这个问题的唯一方法是编写自己的自定义,即时键盘,这是一个非常糟糕的主意。

Just disable voice input programmatically by using XML declarations in the EditText you're looking at. 只需在您正在查看的EditText中使用XML声明,以编程方式禁用语音输入。 You can do this with the attribute: 您可以使用以下属性执行此操作:

android:privateImeOptions="nm"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM