![](/img/trans.png)
[英]Android fullscreen noactionbar change in the designer doesn't work
[英]FullScreen Layout doesn't work on Android
我在Android Studio
有一个带有FrameLayout
的activity_login.xml
,在这种配置下,它不会以全屏模式显示:
AndroidManifest.xml
:
<activity
android:name=".Activities.LoginActivity"
android:label="@string/title_activity_login"
android:launchMode="singleTop"
android:theme="@style/LoginScreenTheme.TranslucentBar" >
</activity>
Styles.xml:
<style name="LoginScreenTheme.TranslucentBar" parent="Theme.AppCompat.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
Toolbar
仍显示在Layout
。
查看您的活动布局,很可能是AndroidStudio为您生成的工具栏视图。 如果这样不起作用,请添加样式:
<item name="android:windowFullscreen">true</item>
如下修改onCreateView()
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
为了删除工具栏/ ActionBar,您根本不需要执行任何特殊操作。 只需将所有内容保留为默认设置,然后转到styles.xml并将AppTheme更改为Theme.AppCompat.Light.NoActionBar,并确保您的活动扩展了AppCompactActivity。 它总是对我有用。 希望它也会对您有帮助。 如果您还想删除StatusBar,请按照上面的@EKN解决方案;)
我什么也没做,今天开始我的项目时,活动处于全屏状态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.