我想将我的应用程序设置为全屏视图。我想到了使用FullScreen
and在单个活动中设置它NoTitlebar
,但我想在我的 Manifest XML 文件中为整个应用程序而不是每个活动设置它......这可能吗?
帮助我...谢谢。
我想将我的应用程序设置为全屏视图。我想到了使用FullScreen
and在单个活动中设置它NoTitlebar
,但我想在我的 Manifest XML 文件中为整个应用程序而不是每个活动设置它......这可能吗?
帮助我...谢谢。
要将您的应用程序或任何单个活动显示设置为全屏模式,请插入代码
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
在 AndroidManifest.xml 中的应用程序或活动选项卡下。
另一种方式:直接在主题中添加windowNoTitle
和属性(您可以在目录中找到文件):windowFullscreen
styles.xml
res/values/
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
在清单文件中,application
指定您的主题
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
如果你Manifest.xml
有默认android:theme="@style/AppTheme"
转到 res/values/styles.xml 并更改
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
到
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
并且ActionBar
消失了!
在,中AndroidManifest.xml
设置标签。android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
application
个别活动可以通过设置自己的主题属性来覆盖默认值。
尝试使用这些主题:Theme.AppCompat.Light.NoActionBar
Mi Style XML 文件看起来像这样并且工作得很好:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>