CardStackView卡堆栈视图

一款适用于Android平台的卡片堆叠视图组件,提供三种动画效果,可通过简单的配置实现类似卡片堆叠的显示效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

One Custom view for show something just like cards with animations.

介绍:

卡片堆叠显示效果,三种动画。

运行效果:

使用说明:

安装

    
  1. dependencies {
  2.     compile 'com.loopeer.library:cardstack:1.0.1'
  3. }

布局

    
  1. <com.loopeer.cardstack.CardStackView
  2.     android:layout_width="match_parent"
  3.     android:layout_height="match_parent"/>

java代码

    
  1. mStackView = (CardStackView) findViewById(R.id.stackview_main);
  2. mTestStackAdapter = new TestStackAdapter(this);
  3. mStackView.setAdapter(mTestStackAdapter);
  4. mTestStackAdapter.updateData(Arrays.asList(TEST_DATAS));
类似社交app tinder的滑动片效果,流畅,体验很好。可以用来实现滑到左边喜欢,右边不喜欢之类的功能,片内容的添加是用的Adapter。项目地址:https://github.com/wenchaojiang/AndroidSwipeableCardStack 效果图:如何使用创建控件实例<com.wenchao.cardstack.CardStack         android:id="@ id/container"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:padding = "20dp"         android:clipChildren="false"         android:clipToPadding="false"     />mCardStack = (CardStack)findViewById(R.id.container);2. 设置单张片的布局文件mCardStack.setContentResource(R.layout.card_content);3.设置AdaptermCardStack.setAdapter(mCardAdapter);一个简单的Adapterpublic class CardsDataAdapter extends ArrayAdapter<String> {     public CardsDataAdapter(Context context, int resource) {         super(context, resource);     }     @Override     public View getView(int position, final View contentView, ViewGroup parent){         TextView v = (TextView)(contentView.findViewById(R.id.content));         v.setText(getItem(position));         return contentView;     } }由于在上面已经设置了单张片的布局文件R.layout.card_content,所以在getView()中你不需要在加载并实例化R.layout.card_content,CardStack已经帮你实例化,你只需要使用contentView。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值