仿饿了么左滑跳转

3,274 阅读1分钟
原文链接: www.jianshu.com

LikeELMLeftLoad

仿饿了么左滑跳转

预览


preview.gif

膜拜巴神

github.com/JeasonWong

使用

(1) 加依赖

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
}

(2) 把View文件内的文件放到你们那的项目中,还有一些配置文件也要拉过去

代码的使用

<csnowstack.load.view.PullLeftLoadMoreLayout
    android:id="@+id/pull_load_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rcv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:overScrollMode="never"/>
</csnowstack.load.view.PullLeftLoadMoreLayout>


mRecyclerView= (RecyclerView) findViewById(R.id.rcv);
       mRecyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false));
       mRecyclerView.setAdapter(new ELMAdapter());

       mPullLeftLoadMoreLayout= (PullLeftLoadMoreLayout) findViewById(R.id.pull_load_layout);
       mPullLeftLoadMoreLayout.addView(getResources().getDimensionPixelOffset(R.dimen.item_img));
       mPullLeftLoadMoreLayout.setFillLoadingColor(ContextCompat.getColor(this,R.color.colorAccent));
       mPullLeftLoadMoreLayout.setOnGoListener(new LoadingView.OnNoticeGoListener() {
           @Override
           public void go() {
               Toast.makeText(MainActivity.this,"跳转页面",Toast.LENGTH_SHORT).show();
           }
       });

修改起来还是很方便的。