且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

启用/禁用键盘声音和振动编程

更新时间:2023-02-26 20:56:57

根据您的意见:

我说的是android系统中默认的键盘,我想有禁用/启用键盘的声音和振动,当用户敲击键盘的按键,(如在键盘设置)的能力。

i'm talking about the default keyboard in android , i want to have the ability to disable / enable keyboard sound and vibration when user tap a key in keyboard,( like in Settings of Keyboard )

&安培;

我现在在三星Galaxy S2,HTC ONE .​​..等

i'm talking about soft keyboard, like in SAMSUNG GALAXY S2 , HTC ONE ...etc

据我所知,你不能做到这一点,因为每个输入法的内部保持它的声音/振动preference值。例如,见的Andr​​oid(AOSP)IME (在写本线30〜39):

AFAIK, you can not accomplish this as each input method keeps its sound/vibration preference values internally. See for example Android (AOSP) IMe (as of this writing lines 30~39):

    <CheckBoxPreference
        android:key="vibrate_on"
        android:title="@string/vibrate_on_keypress"
        android:defaultValue="@bool/config_default_vibration_enabled"
        android:persistent="true" />
    <CheckBoxPreference
        android:key="sound_on"
        android:title="@string/sound_on_keypress"
        android:defaultValue="@bool/config_default_sound_enabled"
        android:persistent="true" />

正如你可以看到它存储在它的共享preference的震动/声音值。
这适用于市场上大多数的IME。因此,你无法控制所有的IME的从单点震动/声音效果。

As you can see it stores the vibrate/sound values in its shared preference. That applies to most of IMe in the market. Hence, you can not control vibrate/sound effect for all IMe's from single point.