Android Inputmethodservice类中的setTheme()
我尝试使用setTheme()方法在自定义键盘上测试不同的主题。我知道应该在onCreate之前调用它,但是当我像这样调用settheme时,它没有任何效果Android Inputmethodservice类中的setTheme(),android,android-softkeyboard,android-styles,android-input-method,Android,Android Softkeyboard,Android Styles,Android Input Method,我尝试使用setTheme()方法在自定义键盘上测试不同的主题。我知道应该在onCreate之前调用它,但是当我像这样调用settheme时,它没有任何效果 public class MyInputMethodService extends InputMethodService{ ... @Override public void onCreate() { setTheme(R.style.ThemeDark); super.onCreate();
public class MyInputMethodService extends InputMethodService{
...
@Override
public void onCreate() {
setTheme(R.style.ThemeDark);
super.onCreate();
}
....
}
然后我尝试了inputview的onCreate方法,如下所示:
@Override
public View onCreateInputView() {
this.setTheme(R.style.ThemeDark);
initPanels();
this.keyboard = keyboardView;
return keyboard;
}
它给了我同样的错误:必须在onCreate()之前调用。
我应该在哪里调用setTheme()
方法来将样式应用于服务类中的整个inputview