全屏幕应用程序的Android [英] full screen application android
问题描述
我有两个问题:
- 在一个人如何可以我跑我的应用程序以全屏幕
- 如何将视频播放器运行在全屏视频。
我已经尝试了很多,仍然在努力实现这一目标,但无法找到一个解决方案。
i have tried alot and still struggling to achieve this but couldn't find a solution.
解决方案列表中,我发现,但他们并不满足我的要求。
the list of solution i found but they are not fulfilling my requirements
-
这只是隐藏通知栏。
this hides only the notification bar.
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
也只能隐藏通知栏
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
它的低剖面的导航栏中没有隐瞒吧。
it low profiles the navigation bar not hiding it.
getWindow()getDecorView()setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
在我的活动没有影响。
anyView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
anyView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
注意:
- 在我说的不是生根的设备,所以请提供这些解决方案,没有生根的设备能正常工作。
- 在我说的不是隐藏两个导航栏和通知栏也只隐藏通知栏,但整个屏幕。
- 在我说的糖豆API 4.1或高于4.1版本的Android 的
- 并请给予解答与code。
在我的研究,您的回答,我得到这样的:
after my research and your answers, i am getting this:
但我的应用程序应该是这样的没有导航栏:
but my app should look like this without navigation bar:
我不希望系统导航栏在我的应用程序可见。
i do not want the system navigation bar visible in my app.
推荐答案
我不知道你追求的是什么,但下面隐藏通知栏和软导航键(因为看到谷歌Nexus-设备) ,所以应用程序基本上是全屏幕。
I'm not sure what you're after, but the following hides the Notification bar, and the Soft Navigation keys (as seen on Google Nexus-devices), so the app essentially is "full screen".
EDIT2
在Android 4.4系统(API 19),谷歌推出了新的沉浸模式,可以隐藏状态和放大器;导航栏,并允许一个真正的全屏界面。
In Android 4.4 (API 19) Google introduced the new Immersive mode which can hide the status & navbar and allow for a truly fullscreen UI.
// This snippet hides the system bars.
private void hideSystemUI() {
// Set the IMMERSIVE flag.
// Set the content to appear under the system bars so that the content
// doesn't resize when the system bars hide and show.
mDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE);
}
// This snippet shows the system bars. It does this by removing all the flags
// except for the ones that make the content appear under the system bars.
private void showSystemUI() {
mDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
参考:
<一href="https://developer.android.com/training/system-ui/immersive.html">https://developer.android.com/training/system-ui/immersive.html
Reference:
https://developer.android.com/training/system-ui/immersive.html
编辑:
测试在Android 4.3(API 18)和Android 4.1(API 16)软导航键。
Tested on Android 4.3 (API 18) and Android 4.1 (API 16) with Soft Nav keys.
@Override
protected void onCreate(Bundle b) {
super.onCreate(b);
setContentView(R.layout.main);
int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
getWindow().getDecorView().setSystemUiVisibility(mUIFlag);
}
有关详细信息<读了href="http://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int)">http://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int)
这篇关于全屏幕应用程序的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!