android github 多页面程序,Github最火开源项目-一分钟实现向左拖拽跳转详情页

0818b9ca8b590ca3270a3433284dd417.png

详细的使用方法在DEMO里面都演示啦,如果你觉得这个库还不错,请赏我一颗star吧~~~

欢迎关注微信公众号、长期为您推荐优秀博文、开源项目、视频

微信公众号名称:Android干货程序员

0818b9ca8b590ca3270a3433284dd417.png

自定义你自己的Footer效果

作为一个library,当然不能只支持以上那一种效果啦,所以,这个库的

Footer应该是可定制的,可插拔的。定制Footer只需定义一个继承自

BaseFooterDrawer的类,然后在参数中提供的区域中绘制即可,而其余

的事件分发,拦截都不需要关心。以下是我自己定制的两种Footer效果。

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

使用步骤

1. 在project的build.gradle添加如下代码(如下图)

allprojects {

repositories {

...

maven { url "https://jitpack.io" }

}

}

0818b9ca8b590ca3270a3433284dd417.png

2. 在Module的build.gradle添加依赖

compile 'com.github.open-android:DragFooterView:0.1.0'

用法

1、在xml中配置如下 (注意:DragContainer只能有一个子View),RecyclerView向左拖拽

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值