yangyxd / FMXUI

FMX跨平台基础UI库
MIT License
262 stars 99 forks source link

应用沉浸式标题栏时,点击页面抖动问题 #41

Open akai1203 opened 2 years ago

akai1203 commented 2 years ago

应用沉浸式标题栏时,点击页面会出现抖动问题

KngStr commented 2 years ago

补充下细节吧,最好是有个demo

FoxPIM commented 2 years ago

看里面的源代码: if M is TApplicationEventMessage then case TApplicationEventMessage(M).Value.Event of TApplicationEvent.BecameActive: begin {$IFDEF ANDROID} // 感谢谭钦的u_Immerse.pas TFrameView.UpdateStatusBar; {$ENDIF} DealForm(Screen.ActiveForm, True); {$IFDEF ANDROID} // 临时的方案,暂未深究原因 TThread.CreateAnonymousThread(procedure begin Sleep(100); TFrameView.UpdateStatusBar; Sleep(100); TFrameView.UpdateStatusBar; Sleep(100); TFrameView.UpdateStatusBar; end).Start; {$ENDIF} end; TApplicationEvent.WillBecomeInactive: DealForm(Screen.ActiveForm, False); end;

三次Sleep造成主Form显示时非沉浸式,与全屏显示有个延时,造成界面显示时最上面会有一个白条一闪而过

FoxPIM commented 2 years ago

这个项目里的浸式标方案并不是完美的,如果第一张Frame界面元素比较复杂,App启动时界面上方状态栏闪动非常明显

KngStr commented 2 years ago

对,这个实现本身就比较尴尬。这里如果要解决,就必须找到是为什么调用了这个,或者说导致需要重新刷新。从我找到的信息来看,跟emb的Java部分是有关的。但那个就需要jar补丁了,所以之前没做。@FoxPIM

FoxPIM commented 2 years ago

你可以看下 https://github.com/viniciusfbb/fmx_tutorials 这个下面的SystemBar项目,它这个相对比较完美,只是发现在Android11下有个Bug,向作者反馈了,没有回应。

KngStr commented 2 years ago

@FoxPIM 感谢分享。不过我短期内是没时间搞了。