如何摆脱android全屏模式下的顶部褪色边缘?

发布于 2024-12-06 05:58:36 字数 495 浏览 2 评论 0原文

通过将以下两行代码放入 Activity.OnCreate 中,我可以获得全屏视图:

requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN );

然而,如果你仔细观察,屏幕顶部边缘仍然有一个轻微的褪色边缘,看起来像是被移除的标题栏的残留物。我怎样才能彻底摆脱它?

请参阅此屏幕截图,这是使用上述两行代码获得的全屏视图,但顶部的淡入淡出边缘可见且烦人,我已经在根目录上尝试了 android:fadingEdge="none" 和 android:fadingEdgeLength="0sp"查看此活动,不起作用: 绿色背景的全屏视图,淡入淡出的边缘可见

By putting the following two lines of code in activity.OnCreate, I can get a full screen view:

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN );

However, if you look carefully, there is still a slight fading edge on the top edge of the screen which looks like a residue of the removed title bar. How can I get rid of that completely?

See this screen capture, which is a fullscreen view obtained using the above two lines of code, but the top fading edge is visible and annoying, I already tried android:fadingEdge="none" and android:fadingEdgeLength="0sp" on the root view of this activity, doesn't work:
A fullscreen view with a green background, fading edge is visible

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我很坚强 2024-12-13 05:58:36

这将满足您的要求:

requestWindowFeature(Window.FEATURE_NO_TITLE);
setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

This will do what you asking for:

requestWindowFeature(Window.FEATURE_NO_TITLE);
setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文