Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

transparent activity's full screen on 2.3

Tags:

android

I was using this xml style:

<style name="Theme.Transparent" parent="@android:style/Theme.Translucent.NoTitleBar">       

This was showing a tansparent layout with full screen, no title bar or status bar on the top in android 2.1 and 2.2. However, when I tested the application on 2.3, the same activity was showing the home screen status bar on the top (battery etc).

I had to enter these lines to my java code onCreate:

requestWindowFeature(Window.FEATURE_NO_TITLE);     
 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 

To get it to remove any status or title bar from the top.

Can anybody shed light why this difference between 2.2 and 2.3?

like image 331
Lumis Avatar asked Jan 25 '11 15:01

Lumis


2 Answers

You can set the theme to:

<style name="Theme.Transparent" parent="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">"

And that should hide both the title bar and fullscreen in every version.

like image 167
Joshua Coffey Avatar answered Oct 08 '22 20:10

Joshua Coffey


You Can Also Use This

 <application android:icon="@drawable/icon" android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
like image 29
Zulfiqar Avatar answered Oct 08 '22 18:10

Zulfiqar