Giter Club home page Giter Club logo

Comments (16)

hushiguang avatar hushiguang commented on May 28, 2024 2

这是动画部分
`
/* 点击的动画 */
private void valueAnimation(final boolean isLeft) {
ValueAnimator animator = ValueAnimator.ofFloat(0, isLeft ? -ScreenUtil.getDisplayWidth() : ScreenUtil.getDisplayWidth());
animator.setInterpolator(new LinearInterpolator());
animator.setDuration(200);
final RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(mRecyclerView.getChildAt(
mRecyclerView.getChildCount() > CardConfig.DEFAULT_SHOW_ITEM ? 0 + CardConfig.DEFAULT_SHOW_ITEM
: mRecyclerView.getChildCount() - 1));
mFloatLeftButton.setEnabled(false);
mFloatRightButton.setEnabled(false);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@OverRide
public void onAnimationUpdate(ValueAnimator animation) {
float value = (float) animation.getAnimatedValue();
cardCallback.onChildDraw(cardCallback.getCanvas(), mRecyclerView, holder, value, 0, ItemTouchHelper.ACTION_STATE_SWIPE
, true);
}
});
animator.addListener(new AnimatorListenerAdapter() {
@OverRide
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
cardCallback.onSwiped(holder, isLeft ? ItemTouchHelper.LEFT : ItemTouchHelper.RIGHT);
cardCallback.clearView(mRecyclerView, holder);
}
});
animator.start();

}`

然后在Callback里面你需要把Canvas拿出来 然后就看你们需求是什么了

from cardswipelayout.

hushiguang avatar hushiguang commented on May 28, 2024 1

你可以自己写个ValueAnimation然后模拟滑动数据,调用onChildDraw方法,可以实现,我是这么做的

from cardswipelayout.

hushiguang avatar hushiguang commented on May 28, 2024 1

@specloli 你挑有用部分去用

from cardswipelayout.

specloli avatar specloli commented on May 28, 2024

求源码分享,现在正在做一个类似的,但是是敏捷开发,正在拼命加班中...

from cardswipelayout.

specloli avatar specloli commented on May 28, 2024

@hushiguang 感谢!!!

from cardswipelayout.

yuqirong avatar yuqirong commented on May 28, 2024

现在将此 issue 关闭 , 有问题可以参考 @hushiguang 上面的代码。

from cardswipelayout.

LoveqLRC avatar LoveqLRC commented on May 28, 2024

表示没看明白,希望作者能加上去,@hushiguang getCanvas() 和onChildDraw里面的实现是什么?

from cardswipelayout.

yuqirong avatar yuqirong commented on May 28, 2024

@LoveqLRC 具体可以看 dev 分支 里面根据这个**写了一个按钮点击滑动卡片的

from cardswipelayout.

LoveqLRC avatar LoveqLRC commented on May 28, 2024

@yuqirong 感谢你的无私奉献

from cardswipelayout.

ThugKd avatar ThugKd commented on May 28, 2024

撤回功能有吗

from cardswipelayout.

xuxinyuancode avatar xuxinyuancode commented on May 28, 2024

@specloli 老哥,请问你解决了点击滑动这个问题了吗?

from cardswipelayout.

ThugKd avatar ThugKd commented on May 28, 2024

@204663476 dev分支有源码啊

from cardswipelayout.

xuxinyuancode avatar xuxinyuancode commented on May 28, 2024

@ThugKd 看到了,谢谢

from cardswipelayout.

xuxinyuancode avatar xuxinyuancode commented on May 28, 2024

@yuqirong @ThugKd item内如果有scrollview会出现滑动冲突,有什么解决办法吗?

from cardswipelayout.

longkehuawei avatar longkehuawei commented on May 28, 2024

@ThugKd 分支在哪里呀,找不到

from cardswipelayout.

longkehuawei avatar longkehuawei commented on May 28, 2024

@xuxinyuancode 分支在哪里?

from cardswipelayout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.