我的RecyclerView
单个项目中有两个观点,两个RelativeLayout
s,在某个时刻,我正在翻转RelativeLayouts
,我正在LayoutA
转动0 to 180
1}}度,同时我从LayoutB
旋转-180 to 0
,所以会有一种翻转的感觉。它工作得很完美,但是当屏幕上没有空格时(例如:RecyclerView
的最后一项)然后我得到了奇怪的效果,在开始这个翻转之前动画LayoutB(最初是隐藏的)展开并隐藏然后动画开始
翻转
<set xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Rotate. -->
<objectAnimator
android:valueFrom="0"
android:valueTo="180"
android:propertyName="rotationY"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="1000" />
<objectAnimator
android:valueFrom="1.0"
android:valueTo="0.0"
android:propertyName="alpha"
android:startOffset="0"
android:duration="1000" />
</set>
翻转
<set xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Rotate. -->
<objectAnimator
android:valueFrom="180"
android:valueTo="0"
android:propertyName="rotationY"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="1000" />
<objectAnimator
android:valueFrom="0.0"
android:valueTo="1.0"
android:propertyName="alpha"
android:duration="1000"
android:startOffset="0"/>
</set>
适配器代码
AnimatorSet setRightOut = (AnimatorSet) AnimatorInflater.loadAnimator
(mContext, R.animator.flip_right_out);
AnimatorSet setLeftIn = (AnimatorSet) AnimatorInflater.loadAnimator(mContext,
R.animator.flip_left_in);
setRightOut.setTarget(holder.layoutA);
setRightOut.setDuration(1500);
setLeftIn.setTarget(holder.layoutB);
setLeftIn.setDuration(1500);
setLeftIn.start();
setRightOut.start();
logcat重复打印,但我没有调用scrollToPosition
方法
logcat的
W/RecyclerView: RecyclerView does not support scrolling to an absolute position. Use scrollToPosition instead
有没有解决这个问题?