FancyCoverFlow——一个页面显示多张图片,中间大,两边小

这个控件继承Gallery,图片之间有间隔,夜歌页面显示三张图,中间大,两边小

效果图:
这里写图片描述

(一、)上面的效果

源码参考:https://github.com/davidschreiber/FancyCoverFlow

将其中的library复制到自己的项目中

(二、)下面的效果

参考源码:https://github.com/LittleLiByte/GlFancyCoverFlow

代码几乎与上面的一样,只是FancyCoverFlow不一样

1、在xml中引用:

<com.ysn.test.customerviews.fancycoverflow.FancyCoverFlow
     android:id="@+id/fancyConverFlow"
     android:layout_width="match_parent"
     android:layout_height="200dp"/>
<!--指定高度之后,代码中的setScaleDownGravity(0.5)才有效果-->

2、适配器必须继承FancyCoverFlowAdapter
如果在xml中没有给高度指定具体数值,则在getView中必须为item根布局设置LayoutParams,例如

WindowManager mn = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
int screenWidth=mn.getDefaultDisplay().getWidth();
llyFancy.setLayoutParams(new FancyCoverFlow.LayoutParams(screenWidth*1/2+30, 
              ViewGroup.LayoutParams.WRAP_CONTENT));

3、代码中的设置适配器和点击事件,同listview

其他参考:旋转木马效果https://github.com/dalong982242260/CarrouselView

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值