I'm making a custom lock screen.
The lock screen is an activity which I launch by the time the screen goes off.
However, I can't make the activity be both transparent & fullscreen.
The Status bar keeps showing.
Here's what I do in the manifest:
<activity android:name=".activities.LockScreenActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
I'm also adding these extras in activit's onCreate:
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.lock_screen);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
But it can't seem to work :|
why?
In Android, we can create a transparent activity that will not be visible but your application will be running. The best part of this transparent activity is that you can create a transparent activity by just changing the resource file and we need not write the java or kotlin code for the same.
delete the code from onCreate(). use this in Manifestfile.
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
otherwise create the theme according to your requirement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With