Android-使活动全屏显示,并在其顶部显示状态栏 [英] Android - Making activity full screen with status bar on top of it
本文介绍了Android-使活动全屏显示,并在其顶部显示状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使我的活动全屏显示,并在其顶部显示状态栏,如下图所示:
I want to make my activity full screen with status bar on top of it like this picture:
我在 activity
标签内的清单
中使用了以下代码:
I have used this code in manifest
inside activity
tag:
'android:theme="@style/Theme.AppCompat.Light.NoActionBar"'
但是我的观点并非从状态栏开始看起来像这样:
But my view doesn't start from the status bar & it looks like this:
我该如何制作我的活动
看起来像第一个?
How can I make my activity
look like the first one?
推荐答案
我知道问这个问题的人可能已经找到了自己的解决方案,但对于仍在寻找解决方案的人们来说,这是一个非常简单的解决方案,但有一个问题是要等到 Kitkat
,添加一个条件
I know that the guy asking the question may have found his own solution but for the people who are still looking for a solution this is a very simple solution but one thing it has a limitation till Kitkat
so a condition is added
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
这篇关于Android-使活动全屏显示,并在其顶部显示状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文