SwipeCardView 仿探探左右滑动效果

该博客介绍了如何使用SwipeFlingAdapterView库创建一个类似探探和Tinder应用的左右滑动卡片效果,包括XML布局配置、Java代码实现以及监听器回调方法的详细说明,展示了如何实现卡片的渐变层叠动画和点击事件处理。

https://github.com/xiepeijie/SwipeCardView

一个带渐变层叠动画的左右滑动效果(类似于探探、tinder)

 

<com.lorentzos.flingswipe.SwipeFlingAdapterView
        android:id="@+id/swipe_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        swipe:min_adapter_stack="4"
        swipe:max_visible="4"
        swipe:y_offset_step="28dp"/>
swipe:y_offset_step="-28dp" 负的上面偏移

Java Code:

核心用法(即AdapterView的用法)

swipeView = (SwipeFlingAdapterView) findViewById(R.id.swipe_view);
        //swipeView.setIsNeedSwipe(true);// 是否开启swipe滑动效果,当不调用此方法设置时,默认开启。
        swipeView.setFlingListener(this);
        swipeView.setOnItemClickListener(this);

onFlingListener的回调方法

   
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值