gpt4 book ai didi

android - Android 中的 Activity 全屏

转载 作者:行者123 更新时间:2023-11-30 02:54:13 26 4
gpt4 key购买 nike

我正在尝试制作类似 Trello 的应用程序,在 Trello 的屏幕截图中看到,它们用背景覆盖了整个屏幕,但仍有时间,标题栏中显示网络,我想在我的应用程序中做同样的事情这样设置背景以完成全屏显示网络和时间。

enter image description here

我正在尝试这个,但它对我不起作用。

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
}

enter image description here

更新

enter image description here

最佳答案

Removing the action bar

You can hide the action bar at runtime by calling hide(). For example:

ActionBar actionBar = getSupportActionBar();
actionBar.hide();

https://developer.android.com/guide/topics/ui/actionbar.html

对于半透明的系统栏(就像在 trello 中),请看这个:

Translucent system bars

You can now make the system bars partially translucent with new themes, Theme.Holo.NoActionBar.TranslucentDecor and Theme.Holo.Light.NoActionBar.TranslucentDecor. By enabling translucent system bars, your layout will fill the area behind the system bars, so you must also enable fitsSystemWindows for the portion of your layout that should not be covered by the system bars.

If you're creating a custom theme, set one of these themes as the parent theme or include the windowTranslucentNavigation and windowTranslucentStatus style properties in your theme.

http://developer.android.com/about/versions/android-4.4.html#UI

关于android - Android 中的 Activity 全屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23579348/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com