Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android full screen an activity and hide key bar

i am new in android programming! i want a full screen image like Hill Climb Racing (as you can see below)

Hill Climb Racing

i try to use

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

but it just disappear action bar and i want to disappear both action bar and android default key bar (home button, back and the another one)

like image 789
strings95 Avatar asked Mar 25 '14 17:03

strings95


2 Answers

If you are targeting android 4.0 and higher

View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
              | View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);

Check this developer site for more detail information

like image 192
droid kid Avatar answered Sep 27 '22 17:09

droid kid


try this in your activity on the manifest

 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
like image 38
wael Avatar answered Sep 27 '22 17:09

wael