仿餓了么左滑跳轉

2010_m 7年前發布 | 7K 次閱讀 安卓開發 Android開發 移動開發

LikeELMLeftLoad

仿餓了么左滑跳轉

預覽

preview.gif

項目地址

https://github.com/CSnowStack/LikeELMLeftLoad

膜拜巴神

https://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();
       }
   });</code></pre> 

修改起來還是很方便的。

 

來自:http://www.jianshu.com/p/e4991d409f76

 

 本文由用戶 2010_m 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!