防止在隐藏状态栏上重传(伪造SYSTEM_UI_FLAG_LAYOUT_STABLE) [英] Preventing relayout on hiding status bar (faking SYSTEM_UI_FLAG_LAYOUT_STABLE)

查看:771
本文介绍了防止在隐藏状态栏上重传(伪造SYSTEM_UI_FLAG_LAYOUT_STABLE)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用具有列表视图和详细信息视图的应用程序,并从列表视图向详细信息视图添加动画.在执行此操作时,我想在某个阶段隐藏状态栏(最好在后台仍显示列表视图时).问题在于,使用

I'm working on app that has a list view and a detail view and I animate from the list view to the detail view. While doing this I'd like to hide the status bar at some stage (preferably while still showing the list view in the background). The problem is that hiding the status bar using

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

使列表视图(或详细信息视图)重新布局.这会使事情看起来很生涩,还可能导致大量处理,从而使动画掉帧.有一个解决方案:

causes the list view (or the detail view) to relayout. This makes things look jerky and also can cause a lot of processing that makes the animation drop frames. There exists a solution to this:

setSystemUiFlags(SYSTEM_UI_FLAG_LAYOUT_STABLE)

setSystemUiFlags(SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)在详细信息视图上

但是这些功能在API 16以下(我针对的是API 14以上)根本无法使用,并且即使在API 16以上的情况下,制造商之间的工作也不一致.

but these don't work at all below API 16 (I'm targeting API 14 and above) and work inconsistently between manufacturers even on API 16 and above.

无论如何,我是否可以隐藏状态栏而不引起重新布局或只是暂时停止布局?

Is there anyway for me to hide the status bar without causing a relayout or just stop layout from happening for a while?

推荐答案

FLAG_LAYOUT_IN_SCREEN FLAG_LAYOUT_INSET_DECOR ?然后,您的窗口将始终在状态栏下方扩展,并且您需要查看插图以确保未在其上覆盖内容,但是这样,当状态栏隐藏或隐藏时,就不应再次布局显示.

How about FLAG_LAYOUT_IN_SCREEN and FLAG_LAYOUT_INSET_DECOR? Your window will then always extend up underneath the status bar, and you'll need to watch the insets to make sure you're not underlapping it with content, but this way you shouldn't be laid out again when the status bar hides or shows.

这篇关于防止在隐藏状态栏上重传(伪造SYSTEM_UI_FLAG_LAYOUT_STABLE)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆