Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full screen transparent activity (no title & status bar) doesn't work.... why?

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?

like image 975
dor506 Avatar asked Dec 24 '11 08:12

dor506


People also ask

What is Transparent activity in Android?

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.


1 Answers

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.

like image 92
RajaReddy PolamReddy Avatar answered Oct 13 '22 14:10

RajaReddy PolamReddy