Android-全屏活动API 14(Android 4.0) [英] Android - Fullscreen activity API 14 (Android 4.0)
本文介绍了Android-全屏活动API 14(Android 4.0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要创建可在API 14(Android 4.0)上使用的全屏活动.我正在使用此代码:
I need to create full screen activity that works on API 14 (Android 4.0). I'm using this code:
protected void onCreate(Bundle savedInstanceState) {
//Remove title
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
它不起作用.我没有看到任何崩溃.
It's not working. I haven't seen any crashes.
推荐答案
尝试一下.
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
MainActivity.java
super.onCreate(savedInstanceState);
getWindow().getDecorView().setSystemUiVisibility(0x10);
setContentView(R.layout.activity_main);
但是我认为这应该可行,并且您的版本也可以.如果您换了
But I think that should work, and your version. If you swapped
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
和
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
这篇关于Android-全屏活动API 14(Android 4.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文