Вопрос

I have an AppWidget (part of my app). I want there to be no sound when the user clicks a button in the widget. How do I do this?

Это было полезно?

Решение

CommonsWare answered it: This is not a method on RemoteViews, and setSoundEffectsEnabled() is not a RemotableViewMethod, so the literal answer is incorrect. However, android:soundEffectsEnabled="false" in the layout file may work.

setting android:soundEffectsEnabled="false" in the xml layout file does indeed work!

Другие советы

As far as I know, you have to turn off notification sounds (pressing volume down, then selecting settings on it). The click sound is usually created by the OS (Samsung Android will have a click but google Nexus will not). The only other way I can think of is, if the widget is yours, create a custom button that overrides that particular functionality.

Add the following line of code to disable the click sound,

yourbutton.setSoundEffectsEnabled(false);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top