We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
我的悬浮布局大概长这样:
F-----
它是可以被收起的,收起后长这样:
F
问题在于,我的吸附方式是水平吸附:setSidePattern(SidePattern.RESULT_HORIZONTAL)
setSidePattern(SidePattern.RESULT_HORIZONTAL)
这里在吸附到左侧时,悬浮而已收起时正常:
|-----------------------| |F----- | -> |-----------------------| |F |
但是在右侧时,会变成这样:
|-----------------------| | F-----| -> |-----------------------| | F | -(动画)-> |-----------------------| | F|
所以我的想法是可以动态修改layoutChangedGravity。 但是我目前只能用反射:
layoutChangedGravity
private fun setLayoutChangedGravity(gravity: Int) { // FloatingWindowManager.getHelper(TAG_SECURITY)?.config?.layoutChangedGravity = gravity try { val floatingWindowManagerClass = Class.forName("com.lzf.easyfloat.core.FloatingWindowManager") val instanceField = floatingWindowManagerClass.getDeclaredField("INSTANCE") instanceField.isAccessible = true val floatingWindowManagerInstance = instanceField.get(null) val getHelperMethod = floatingWindowManagerClass.getDeclaredMethod("getHelper", String::class.java) getHelperMethod.isAccessible = true val floatingWindowHelper = getHelperMethod.invoke(floatingWindowManagerInstance, TAG_SECURITY) val floatingWindowHelperClass = floatingWindowHelper.javaClass val configField = floatingWindowHelperClass.getDeclaredField("config") configField.isAccessible = true val config = configField.get(floatingWindowHelper) val configClass = config.javaClass val layoutChangedGravityField = configClass.getDeclaredField("layoutChangedGravity") layoutChangedGravityField.isAccessible = true layoutChangedGravityField.set(config, gravity) } catch (e: Exception) { Lg.e("反射修改 LayoutChangedGravity 失败", e) }
有什么更好的办法吗?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我的悬浮布局大概长这样:
F-----
它是可以被收起的,收起后长这样:
F
问题在于,我的吸附方式是水平吸附:
setSidePattern(SidePattern.RESULT_HORIZONTAL)
这里在吸附到左侧时,悬浮而已收起时正常:
但是在右侧时,会变成这样:
所以我的想法是可以动态修改
layoutChangedGravity
。但是我目前只能用反射:
有什么更好的办法吗?
The text was updated successfully, but these errors were encountered: