简体   繁体   中英

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)

登山比赛

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)

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

在清单上的活动中尝试这个

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM