Android phone app If not full screen, the system default top status bar color (black) will undermine the design of the overall style and beauty of the APP, so, the status bar processing, the individual feel is still very necessary.
In Qt 5.9, using the QML declarative language, through the screen object to get to the device's length and width, can be obtained to the entire device's length and remove the phone top of the status bar after the length of the width, it can be said very convenient, but when you set the entire Windows Object or Applicationwindow object of the length of the device to the maximum length of time, it will be found and can not take effect, the status bar is standing, forget to say, this immersive status bar only in Android 4.4 and later version will be effective, 4.4 below is not supported at all, So you should pay attention to the system version of your debug device.
When I was doing this, I searched a lot of blogs on the internet, and a part of it was to use screen to get a long and wide fullscreen, and then, to place a transparent rectangle on top of it, this method did not succeed under Qt 5.9, because it couldn't be full-screen at all, and after that, the status bar would be shadow hidden. Even if you set the transparency can not see it, this way Pass!
The second is to set the style through Androidmanifest.xml, first add the style file under the Android/res folder, and then in the Androidmanifest.xml reference, the style file is set
The Android:windowtranslucentstatus property is true and then sets the
The Android:fitssystemwindows property is true, and then just do it, because this is already in use of the Android system itself to set up, almost out of Qt, the feeling is still very reliable, but I still failed. Uncomfortable...
The above two ways, interested friends can try their own first, perhaps I open the wrong way, in case you succeed!
Finally, I think of the JNI, the Android system is implemented by Java, I directly through the Java code to implement this thing, theoretically absolutely feasible ah, so, I built a androidmanifest.xml, add my own Java files, in the file , overloaded the entry function onCreate () of the Android system program, the code is as follows :
@Override
public void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_FULLSCREEN);
GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
In fact, nothing, is a word of the matter, and then the program automatically fullscreen, the status bar is also transparent, the effect such as:
This is the way I stole it from the Android developer blog, it feels like andoid development, all the same, ask me why? Hen ~ ~ ~ This way I think in fact and set style is the same reason, as to why I set style failure, not clear, you can try it yourself, if successful, you can not add Java files, very good ....
Finally, this thing is actually not called immersive status bar, immersive is actually the kind of full-screen game, the whole screen is the kind of window, the name is because of the same, the official did not give the exact names, the developer casually take the name, but, not important, eggs delicious, no need to know the name of the hen, There's no need to know who this egg is.
To this thing still have problem of old iron, can leave a message, I will see will reply in time, so, bye~~~
Qt 5.9 for Android immersive status bar