Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

系统悬浮窗一闪而过 #149

Closed
HelloJokerWord opened this issue Apr 18, 2024 · 2 comments
Closed

系统悬浮窗一闪而过 #149

HelloJokerWord opened this issue Apr 18, 2024 · 2 comments

Comments

@HelloJokerWord
Copy link

HelloJokerWord commented Apr 18, 2024

问题描述:设置为系统悬浮窗和默认位置右下角时,特别是一些比较差的手机,会明显在从左上角显示一下,然后快速的滑动到配置的右下角。设置为应用内(FxScopeType.APP) 时,就没这一闪的感觉了,或者好一些

使用版本:2.6.0

测试配置:
// 设置悬浮窗默认方向
setGravity(FxGravity.RIGHT_OR_CENTER)
// 设置偏移位置
setOffsetXY(0f, ConvertUtils.dp2px(200f).toFloat())

其他xy什么的就都没设置了。

看了下源码的:
registerWM(wm: WindowManager) 默认 gravity = Gravity.TOP or Gravity.START
不知道会不会是不是这个原因。

@Petterpx
Copy link
Owner

Petterpx commented May 5, 2024

registerWM

有一个时机问题,可以考虑后续优化下,目前感知应该几乎很小。
原理是:浮窗要实现各种位置定义时,最好的方式就是自行根据传递的gravity去计算位置,故只能默认先放置在view初始位置(左上角),后续得到浮窗大小,再进行更新,这里面存在了10ms左右的差值

@Petterpx Petterpx reopened this May 5, 2024
@Petterpx
Copy link
Owner

Petterpx commented May 5, 2024

更新到2.1.0即可

@Petterpx Petterpx closed this as completed May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants