EF's Blog

Posts Tagged ‘bar

you can add this

//remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);

super.onCreate(savedInstanceState);
setContentView(R.layout.main);

make sure the line is before layout declaration or your app will crash

Advertisements

create new class

public class basicdisplayoption {
public static void toggleStatusBar(Activity myActivityReference, boolean boolYesNo) {
if(boolYesNo == true)
{
WindowManager.LayoutParams attrs = myActivityReference.getWindow().getAttributes();
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
myActivityReference.getWindow().setAttributes(attrs);
}
else
{
WindowManager.LayoutParams attrs = myActivityReference.getWindow().getAttributes();
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
myActivityReference.getWindow().setAttributes(attrs);
}
}
}

and
at activity onCreate, to turn on status bar, call
basicdisplayoption.toggleStatusBar(sinarmasmsiglife.this, true);
to turn off :
basicdisplayoption.toggleStatusBar(sinarmasmsiglife.this, false);


EF’s Blog

I'm just ordinary people who lived in an extra-ordinary world.

EF's Blog Stats

  • 138,553 hits
October 2017
M T W T F S S
« Jul    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Archives