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
  • 25,445
  • 23
  • 94
  • 171
naresh
  • 10,052
  • 25
  • 78
  • 124

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
  • 25,445
  • 23
  • 94
  • 171
ρяσѕρєя K
  • 130,641
  • 51
  • 193
  • 212
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
  • 130,641
  • 51
  • 193
  • 212
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,024
  • 2
  • 26
  • 41
Praveenkumar
  • 25,445
  • 23
  • 94
  • 171