问题
I'm developing my first Cordova plugin as a means to learn Cordova better. I'm however stock and hope you guys can help with the last bits.
The source can be found at https://github.com/dotnetCarpenter/cordova-plugins/tree/master/FullscreenPlugin
The aim is to develop a full screen plugin which can toggle between states. As shown here at SO, it should only be three lines.
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
Which translated to Cordova would be:
Activity activity = this.cordova.getActivity();
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
activity.getWindow()
.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
);
activity.setContentView(R.layout.main);
R.layout.main
gave me all kinds of trouble. Maybe because I'm missing something in my plugin.xml. I'm not sure.
Anyway, after finding a post about toggling full screen.
I figured I change the last line to:
activity.getCurrentFocus().requestLayout();
Unfortunately to no avail. I have tested a bunch of different setups, including this.webView.requestLayout();
, but have reached my end.
I'm stuck!
I would appreciate if anyone could point me in the right direction.
Cheers, Jon
来源:https://stackoverflow.com/questions/20005746/enable-appearence-on-window-after-setflags-on-android-cordova