Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 其他键盘视图仅在关闭应用程序后加载_Java_Android_Keyboard_Sharedpreferences - Fatal编程技术网

Java 其他键盘视图仅在关闭应用程序后加载

Java 其他键盘视图仅在关闭应用程序后加载,java,android,keyboard,sharedpreferences,Java,Android,Keyboard,Sharedpreferences,我在玩软键盘 我在我的首选项中做了一个复选框 <CheckBoxPreference android:defaultValue="false" android:key="OneColors" android:summary="Show one color keys above the keyboard" android:title="One color keys" > @onInitializeInte

我在玩软键盘

我在我的首选项中做了一个复选框

        <CheckBoxPreference
        android:defaultValue="false"
        android:key="OneColors"
        android:summary="Show one color keys above the keyboard"
        android:title="One color keys" >
@
onInitializeInterface()
with

    SharedPreferences lala = 
            getSharedPreferences("com.keyboard_preferences", Context.MODE_PRIVATE);

    if (lala.getBoolean("OneColors", true)){
        this.mQwertyKeyboard = new EmojiKeyboard(this, R.xml.qwertycolor);
    } else {
        this.mQwertyKeyboard = new EmojiKeyboard(this, R.xml.qwerty);
    }

我现在遇到的问题是,我的键盘发生了变化,但只有在关闭整个应用程序并再次打开它之后,这个问题才得以解决

        SharedPreferences lala = 
            getSharedPreferences("eu.drgekko.rftoolz_preferences", Context.MODE_PRIVATE);

    if (lala.getBoolean("OneColors", true)){
        this.mQwertyKeyboard = new EmojiKeyboard(this, R.xml.qwertycolor);

    } else {
        this.mQwertyKeyboard = new EmojiKeyboard(this, R.xml.qwerty);

    }
onStartInput()

thnx至

@GabeSechan

你希望键盘什么时候会改变,你在做什么来触发它?如果这里只有这些,那么您只能在启动时或主要配置更改前后看到更改。如果您想在每次设置更改后都能看到它,您需要切换到更频繁的调用,可能是onStartInput或onStartInputView。@Gabeschen将尝试此方法thnx@GabeSechan是的,它起作用了。NX将它添加到onStartInput中
        SharedPreferences lala = 
            getSharedPreferences("eu.drgekko.rftoolz_preferences", Context.MODE_PRIVATE);

    if (lala.getBoolean("OneColors", true)){
        this.mQwertyKeyboard = new EmojiKeyboard(this, R.xml.qwertycolor);

    } else {
        this.mQwertyKeyboard = new EmojiKeyboard(this, R.xml.qwerty);

    }