YoKeyword / Fragmentation

[DEPRECATED] A powerful library that manage Fragment for Android
Apache License 2.0
9.72k stars 2.11k forks source link

SwipeBackLayout问题 #445

Closed SjAndy88 closed 7 years ago

SjAndy88 commented 7 years ago

在布局里面如果有View使wrap_content的,并且会不断绘制不同内容导致布局不停计算,会无法正常使用swipeback功能,界面会出现来回抖动,试用了原始的SwipeBackLayout的工程不会出现此问题

测试很简单 只要在布局加入一个textview使wrap_content的 <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="0"/> 然后在代码里面不停的刷新 private void postText() { mTextView.postDelayed(new Runnable() { @Override public void run() { mTextView.setText(SystemClock.currentThreadTimeMillis() + ""); postText(); } }, 100); }

Fragmentation 中有问题的录像 device-2017-07-23-205230.mp4.zip

SwipeBackLayout 原始工程没有问题 device-2017-07-23-205721.mp4.zip

问题原因是原始工程使用的ViewDragHelper是自定义的,而Fragmentation使用的是support中的ViewDragHelper,support 25.3.1中的似乎在计算mCapturedView.getLeft()的时候会因为整改view树在做刷新动作而获取0,使计算出问题,导致来回抖动。

SjAndy88 commented 7 years ago

@YoKeyword 能看下这个问题吗?

YoKeyword commented 7 years ago

@flztsj 已修复, v1.0.8