I am setting a specific activity full screen when the use hits a START button.
In this case the showStopButton()
is called .
It\'s running fine
it's so simple ... I just need to hide the ActionBar... then show it when back to standard screen...
private void showStopButton(){
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
ActionBar actionBar = getActionBar();
actionBar.hide();
getWindow().findViewById(android.R.id.content).requestLayout();
So:
@Override
protected void onCreate(
final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Make this activity, full screen
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Hide the Title bar of this activity screen
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
// MORE INIT STUFF HERE...
//img = (ImageView) findViewById(R.id.imgRandom);
//btnRandom = (Button) findViewById(R.id.btnRandom);
}
Add this.
requestWindowFeature(Window.FEATURE_NO_TITLE);
before
super.onCreate(savedInstanceState);
setContentView(R.layout.your activity);
Use -public class MainActivity extends Activity- instead of -public class MainActivity extends ActionBarActivity-
Try this one......
public class MainActivity extends Activity {
Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = this;
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
}
}