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);
}