如何通过 Android Manifest 使我的 Android 应用程序全屏?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12593177/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to Make my Android App FullScreen via Android Manifest?
提问by apw2012
How do I do this? Any suggestions? BTW I am using SDK with AIDE.
我该怎么做呢?有什么建议?顺便说一句,我在 AIDE 中使用 SDK。
回答by SquiresSquire
Go into the manifest and use a full screen theme.
进入清单并使用全屏主题。
<activity
android:name=".Foo"
android:label="@string/foo"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
回答by Milon
This code makes the current Activity Full-Screen. No Status-Bar or anything except the Activity-Window!
此代码使当前活动全屏。除了活动窗口之外没有状态栏或任何东西!
public class FullScreen extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
}
Edit for AppCompactActivity
编辑 AppCompactActivity
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/orange</item>
<item name="colorPrimaryDark">@android:color/holo_orange_dark</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
回答by apw2012
If you want a full screen put this attribute in <activity />
or <application />
tag in your Manifest file
如果您想要全屏显示,请将此属性放入<activity />
或<application />
标记在您的清单文件中
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
回答by Lucifer
Agree with the above answer given by SquiresSquire. Just adding little more information in the answer i would like to present my answer.
同意以上SquiresSquire给出的回答。只是在答案中添加更多信息,我想提出我的答案。
You can make your application full screen in two ways,
您可以通过两种方式使您的应用程序全屏显示,
Making Full Screen any particular Activity
add theme element in activity tag
<activity android:name=".YourActivityName" android:theme="@android:style/Theme.NoTitleBar.">
Making Full Screen whole application
add theme element with application tag
<application android:icon="@drawable/icon" android:theme="@android:style/Theme.NoTitleBar.">
使任何特定活动全屏
在活动标签中添加主题元素
<activity android:name=".YourActivityName" android:theme="@android:style/Theme.NoTitleBar.">
制作全屏整个应用程序
添加带有应用程序标签的主题元素
<application android:icon="@drawable/icon" android:theme="@android:style/Theme.NoTitleBar.">
回答by AndroidLover
To set your Application or any individual activity display in Full Screen mode,
要将您的应用程序或任何单个活动设置为全屏模式,
Insert the code in AndroidManifest .xml file
在 AndroidManifest .xml 文件中插入代码
@android:style /Theme. NoTitle Bar.Fullscreen
回答by arc
This works well for me.
这对我很有效。
android:theme="@style/Theme.AppCompat.NoActionBar"