Github最火开源项目-一分钟实现向左拖拽跳转详情页
2017-05-08 22:20
477 查看
开源地址:https://github.com/open-android/DragFooterView
一个向左拖拽跳转至更多页面的通用控件
视频地址:https://v.qq.com/x/page/a0383m70fzs.html
详细的使用方法在DEMO里面都演示啦,如果你觉得这个库还不错,请赏我一颗star吧~~~
欢迎关注微信公众号、长期为您推荐优秀博文、开源项目、视频
微信公众号名称:Android干货程序员
Footer应该是可定制的,可插拔的。定制Footer只需定义一个继承自
BaseFooterDrawer的类,然后在参数中提供的区域中绘制即可,而其余
的事件分发,拦截都不需要关心。以下是我自己定制的两种Footer效果。
2、在java类中添加事件监听器DragListener
* 细节注意:
//若需使用自己定制的footer,需要调用DragContainer的setFooterDrawer方法设置定制的footer类,如下
dragContainer.setFooterDrawer(new ArrowPathFooterDrawer.Builder(this, 0xff444444).setPathColor(0xffffffff).build());
一个向左拖拽跳转至更多页面的通用控件
视频地址:https://v.qq.com/x/page/a0383m70fzs.html
详细的使用方法在DEMO里面都演示啦,如果你觉得这个库还不错,请赏我一颗star吧~~~
欢迎关注微信公众号、长期为您推荐优秀博文、开源项目、视频
微信公众号名称:Android干货程序员
自定义你自己的Footer效果
作为一个library,当然不能只支持以上那一种效果啦,所以,这个库的Footer应该是可定制的,可插拔的。定制Footer只需定义一个继承自
BaseFooterDrawer的类,然后在参数中提供的区域中绘制即可,而其余
的事件分发,拦截都不需要关心。以下是我自己定制的两种Footer效果。
使用步骤
1. 在project的build.gradle添加如下代码(如下图)
allprojects { repositories { ... maven { url "https://jitpack.io" } } }
2. 在Module的build.gradle添加依赖
compile 'com.github.open-android:DragFooterView:0.1.0'
用法
1、在xml中配置如下 (注意:DragContainer只能有一个子View),RecyclerView向左拖拽<com.fangxu.library.DragContainer android:id="@+id/drag_recycler_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp"> <android.support.v7.widget.RecyclerView android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" /> </com.fangxu.library.DragContainer>
2、在java类中添加事件监听器DragListener
DragContainer dragContainer = (DragContainer) findViewById(R.id.drag_recycler_view); //若需使用自己定制的footer,需要调用DragContainer的setFooterDrawer方法设置定制的footer类,如下 dragContainer.setFooterDrawer(new ArrowPathFooterDrawer.Builder(this, 0xff444444).setPathColor(0xffffffff).build()); dragContainer.setDragListener(new DragListener() { @Override public void onDragEvent() { //do whatever you want,for example skip to the load more Activity. Intent intent = new Intent(HomeActivity.this, ShowMoreActivity.class); startActivity(intent); } }); @Override public void onDragEvent() { Intent intent = new Intent(HomeActivity.this, ShowMoreActivity.class); startActivity(intent); }
属性
attribute | value type | defalut value | description |
---|---|---|---|
dc_footer_color | color | 0xffcdcdcd | footer view的背景颜色 |
dc_reset_animator_duration | integer | 700 | 松开拖拽后复位动画的时长 |
dc_drag_damp | float | 0.5f | 拖拽阻尼系数,取值在(0,1]之间,取值越小,阻尼越大 |
//若需使用自己定制的footer,需要调用DragContainer的setFooterDrawer方法设置定制的footer类,如下
dragContainer.setFooterDrawer(new ArrowPathFooterDrawer.Builder(this, 0xff444444).setPathColor(0xffffffff).build());
其他控件用法 (HorizontalScrollView用法)
“`xml```java private void setupHorizontalScrollView() { LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linear_layout); for (int i = 10; i < 20; i++) { ImageView imageView = new ImageView(this); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(dp2px(120), ViewGroup.LayoutParams.MATCH_PARENT); params.leftMargin = 0; params.rightMargin = dp2px(5); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setLayoutParams(params); linearLayout.addView(imageView); Glide.with(this).load(Constants.urls[i]).into(imageView); } DragContainer dragContainer = (DragContainer) findViewById(R.id.drag_scroll_view); BaseFooterDrawer drawer = new com.fangxu.dragfooterview.customfooters.ArrowPathFooterDrawer.Builder(this, 0xff444444).setPathColor(0xffffffff).build(); dragContainer.setFooterDrawer(drawer); dragContainer.setDragListener(this); }
(ImageView用法)
“`xml相关文章推荐
- Github最火开源项目-一分钟实现ViewPager上下滑动
- github开源项目-算法实现之路
- Github最火开源项目-三十秒实现QQ首页动画特效
- GIthub开源项目实现翻页效果(FlipView)
- github项目解析(九)-->实现activity跳转动画的五种方式
- Github最火开源项目-一行代码实现ofo小黄车的引导界面
- 采用github上的开源项目Android-PullToRefresh实现ListView的下拉刷新和上拉加载
- Github项目解析(九)-->实现Activity跳转动画的五种方式
- Github最火开源项目-一分钟学会旋转选择器WheelPicker使用
- 我的github地址,里边有一些拍照功能,选择照片功能的实现,还有一些其它的开源项目
- Android项目笔记【项目管理统计图app】:使用github上的cardslib开源项目实现CardView(1)
- 【凡尘工作室】 微信平台架构和实现(github开源项目)
- Github最火开源项目-一分钟学会自定义ImageView外貌
- 高分求救,微软屏传开源的项目,里面也有屏传的代码,是用C#实现的。
- 开源了as写的xmpp协议栈和多维运动图表motionchart项目在github
- 集成开源系统实现自动化构建、代码质量评估、项目信息统计(1)——Jenkins安装
- IM 开源项目 群组服务 缓存设计实现之 成员属性
- IM 开源项目 群组服务 缓存设计实现之 群组属性
- 改造apache的开源日志项目来实现 分布式日志收集系统
- 移植开源项目obexftp到android平台下实现蓝牙ftp的功能