首页

源码搜藏网

首页 > 安卓源码 > 控件分类 > RecyclerViews >

RecyclerView实现的滑动删除的安卓效果

创建时间:2016-08-23 11:44  

RecyclerView实现的滑动删除的安卓效果
RecyclerView实现的滑动删除的安卓效果
暂无演示 立即下载
滑动删除的RecyclerView,一个非常容易使用实现滑动删除效果RecyclerViewSwipeDismiss

预习

预习

如何使用


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

dependencies {
     compile 'com.github.CodeFalling:RecyclerViewSwipeDismiss:v1.1.3'
}

	
SwipeDismissRecyclerViewTouchListener listener = new SwipeDismissRecyclerViewTouchListener.Builder(
        recyclerView,
        new SwipeDismissRecyclerViewTouchListener.DismissCallbacks() {
            @Override
            public boolean canDismiss(int position) {
                return true;
            }

            @Override
            public void onDismiss(View view) {
                // Do what you want when dismiss

            }
        })
        .setIsVertical(false)
        .setItemTouchCallback(
                new SwipeDismissRecyclerViewTouchListener.OnItemTouchCallBack() {
                    @Override
                    public void onTouch(int index) {
                        // Do what you want when item be touched
                    }
                })
        .setItemClickCallback(new SwipeDismissRecyclerViewTouchListener.OnItemClickCallBack() {
                    @Override
                    public void onClick(int position) {
                        // Do what you want when item be clicked                    }
                })
        .setBackgroundId(R.drawable.bg_item_normal, R.drawable.bg_item_selected)
        .create();
recyclerView.setOnTouchListener(listener);

更多

上一篇:通过RecyclerViews实现Google Photo中的多选效果
下一篇:基于SuperSlim项目,以及Reaml封装的RecyclerView

相关内容

热门推荐