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

侧滑返回的距离 #3

Open
DaneChen opened this issue Nov 24, 2018 · 1 comment
Open

侧滑返回的距离 #3

DaneChen opened this issue Nov 24, 2018 · 1 comment

Comments

@DaneChen
Copy link

侧滑返回功能,目前是滑动到屏幕一半宽度触发关闭。如果要改成其他距离呢?
我尝试在SwipeBackHelper中673行,修改逻辑
if (mShadowView.getWidth() + 2 * mShadowView.getTranslationX() >= 0)

也没什么效果,发现mShadowView.getTranslationX()要么为0,要么是 的屏幕最大宽度
应该是在动画中已经决定了这个值。
然后在startSwipeAnimator中记录startValue值,再673行中与屏幕相比,是可以触发关闭,但是关闭的动画上存在问题。
期待回复~~

@Simon-Leeeeeeeee
Copy link
Owner

@DaneChen 你好,抱歉我后来忘记回复你的提问。你提到mShadowView的值确实是在动画中就已经做了处理,参见DecelerateAnimator类中startAnimator方法,第207行mFinalValue = (finalValue * 2 < minFinalValue + maxFinalValue) ? minFinalValue : maxFinalValue;这里限定了动画结束的终值要么取最大要么取最小。

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