0

I set the following property in application tag of manifeast file. but it hides both titlebar(Actionbar) and Statusbar.Here i want to hide only the statusbar.

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

Praveenkumar
  • 24,084
  • 23
  • 95
  • 173
naresh
  • 10,332
  • 25
  • 81
  • 124
  • Check out this answer, http://stackoverflow.com/questions/5431365/how-to-hide-status-bar-in-android – Austin Jun 14 '12 at 07:50
  • @Austin: I need title/action bar. Your code hides both the status and title/action bar – naresh Jun 14 '12 at 07:53

3 Answers3

2

for hiding only status bar add this code in oncrete of activity:

// Hide the Status Bar
 
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
 
WindowManager.LayoutParams.FLAG_FULLSCREEN);

and remove android:theme="@android:style/Theme.NoTitleBar.Fullscreen" from manifest

Praveenkumar
  • 24,084
  • 23
  • 95
  • 173
ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213
1
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

add this code to begining of your activity

ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213
uulker
  • 41
  • 5
1

Try the following code snippet:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

     /* add below 2 lines*/
    getWindow().clearFlags(android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
Sharp Edge
  • 4,144
  • 2
  • 27
  • 41
Praveenkumar
  • 24,084
  • 23
  • 95
  • 173