天天看點

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解

轉自:http://blog.csdn.net/lmj623565791/article/details/38238749,本文出自:【張鴻洋的部落格】

群裡一哥們今天聊天偶然提到這個git hub上的控件:pull-to-refresh ,有興趣的看下,例子中的功能極其強大,支援很多控件。本篇部落格詳細給大家介紹下ListView和GridView利用pull-to-rerfesh 實作下拉重新整理和上拉加載更多。

1、ListView下拉重新整理快速入門

pull-to-refresh對ListView進行了封裝,叫做:PullToRefreshListView,用法和listview沒什麼差別,下面看demo.

布局檔案:

[html]  view plain copy

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
  1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  2.     xmlns:tools="http://schemas.android.com/tools"  
  3.     android:layout_width="match_parent"  
  4.     android:layout_height="match_parent" >  
  5.     <com.handmark.pulltorefresh.library.PullToRefreshListView  
  6.         xmlns:ptr="http://schemas.android.com/apk/res-auto"  
  7.         android:id="@+id/pull_refresh_list"  
  8.         android:layout_width="fill_parent"  
  9.         android:layout_height="fill_parent"  
  10.         android:cacheColorHint="#00000000"  
  11.         android:divider="#19000000"  
  12.         android:dividerHeight="4dp"  
  13.         android:fadingEdge="none"  
  14.         android:fastScrollEnabled="false"  
  15.         android:footerDividersEnabled="false"  
  16.         android:headerDividersEnabled="false"  
  17.         android:smoothScrollbar="true" >  
  18.     </com.handmark.pulltorefresh.library.PullToRefreshListView>  
  19. </RelativeLayout>  

聲明了一個PullToRefreshListView,裡面所有的屬性都是ListView的,沒有任何其他屬性,當然了PullToRefreshListView也提供了很多配置的屬性,後面會詳細介紹。

Activity的代碼:

[java]  view plain copy

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
  1. package com.example.zhy_pulltorefreash_chenyoca;  
  2. import java.util.LinkedList;  
  3. import android.app.Activity;  
  4. import android.os.AsyncTask;  
  5. import android.os.Bundle;  
  6. import android.text.format.DateUtils;  
  7. import android.widget.ArrayAdapter;  
  8. import android.widget.ListView;  
  9. import com.handmark.pulltorefresh.library.PullToRefreshBase;  
  10. import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;  
  11. import com.handmark.pulltorefresh.library.PullToRefreshListView;  
  12. public class PullToRefreshListActivity extends Activity  
  13. {  
  14.     private LinkedList<String> mListItems;  
  15.     private PullToRefreshListView mPullRefreshListView;  
  16.     private ArrayAdapter<String> mAdapter;  
  17.     private int mItemCount = 9;  
  18.     @Override  
  19.     protected void onCreate(Bundle savedInstanceState)  
  20.     {  
  21.         super.onCreate(savedInstanceState);  
  22.         setContentView(R.layout.activity_main);  
  23.         // 得到控件  
  24.         mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);  
  25.         //初始化資料  
  26.         initDatas();  
  27.         //設定擴充卡  
  28.         mAdapter = new ArrayAdapter<String>(this,  
  29.                 android.R.layout.simple_list_item_1, mListItems);  
  30.         mPullRefreshListView.setAdapter(mAdapter);  
  31.         // 設定監聽事件  
  32.         mPullRefreshListView  
  33.                 .setOnRefreshListener(new OnRefreshListener<ListView>()  
  34.                 {  
  35.                     @Override  
  36.                     public void onRefresh(  
  37.                             PullToRefreshBase<ListView> refreshView)  
  38.                     {  
  39.                         String label = DateUtils.formatDateTime(  
  40.                                 getApplicationContext(),  
  41.                                 System.currentTimeMillis(),  
  42.                                 DateUtils.FORMAT_SHOW_TIME  
  43.                                         | DateUtils.FORMAT_SHOW_DATE  
  44.                                         | DateUtils.FORMAT_ABBREV_ALL);  
  45.                         // 顯示最後更新的時間  
  46.                         refreshView.getLoadingLayoutProxy()  
  47.                                 .setLastUpdatedLabel(label);  
  48.                         // 模拟加載任務  
  49.                         new GetDataTask().execute();  
  50.                     }  
  51.                 });  
  52.     }  
  53.     private void initDatas()  
  54.     {  
  55.         // 初始化資料和資料源  
  56.         mListItems = new LinkedList<String>();  
  57.         for (int i = 0; i < mItemCount; i++)  
  58.         {  
  59.             mListItems.add("" + i);  
  60.         }  
  61.     }  
  62.     private class GetDataTask extends AsyncTask<Void, Void, String>  
  63.     {  
  64.         @Override  
  65.         protected String doInBackground(Void... params)  
  66.         {  
  67.             try  
  68.             {  
  69.                 Thread.sleep(2000);  
  70.             } catch (InterruptedException e)  
  71.             {  
  72.             }  
  73.             return "" + (mItemCount++);  
  74.         }  
  75.         @Override  
  76.         protected void onPostExecute(String result)  
  77.         {  
  78.             mListItems.add(result);  
  79.             mAdapter.notifyDataSetChanged();  
  80.             // Call onRefreshComplete when the list has been refreshed.  
  81.             mPullRefreshListView.onRefreshComplete();  
  82.         }  
  83.     }  
  84. }  

代碼極其簡單,得到PullToRefreshListView控件,然後像ListView一樣設定資料集。當然了,我們有下拉重新整理,是以必須設定下拉重新整理的回調:

setOnRefreshListener(new OnRefreshListener<ListView>(){}

我們在回調中模拟了一個異步任務,加載了一個Item。

效果圖:

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解

下拉時,執行我們的GetDataTask任務,任務執行完成後在onPostExecute中調用mPullRefreshListView.onRefreshComplete();完成重新整理。

是不是分分鐘實作下拉重新整理。當然了,你可能會有疑問,下拉重新整理的訓示器上的文字可以自定義嗎?那個圖檔可以換成箭頭嗎?說好的上拉加載更多呢?後面會一一添加~

2、添加上拉加載更多

如過希望實作上拉加載更多,那麼首先需要在布局檔案的聲明屬性中添加一個屬性,用于指定目前的下拉模式:

[html]  view plain copy

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
  1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  2.     xmlns:tools="http://schemas.android.com/tools"  
  3.     android:layout_width="match_parent"  
  4.     android:layout_height="match_parent" >  
  5.     <com.handmark.pulltorefresh.library.PullToRefreshListView  
  6.         xmlns:ptr="http://schemas.android.com/apk/res-auto"  
  7.         android:id="@+id/pull_refresh_list"  
  8.         android:layout_width="fill_parent"  
  9.         android:layout_height="fill_parent"  
  10.         android:cacheColorHint="#00000000"  
  11.         android:divider="#19000000"  
  12.         android:dividerHeight="4dp"  
  13.         android:fadingEdge="none"  
  14.         android:fastScrollEnabled="false"  
  15.         android:footerDividersEnabled="false"  
  16.         android:headerDividersEnabled="false"  
  17.         android:smoothScrollbar="true"  
  18.         ptr:ptrMode="both" >  
  19.     </com.handmark.pulltorefresh.library.PullToRefreshListView>  
  20. </RelativeLayout>  

我們添加了一個屬性:ptr:ptrMode="both" ,意思:上拉和下拉都支援。

可選值為:disabled(禁用下拉重新整理),pullFromStart(僅支援下拉重新整理),pullFromEnd(僅支援上拉重新整理),both(二者都支援),manualOnly(隻允許手動觸發)

當然了,如果你不喜歡在布局檔案中指定,完全可以使用代碼設定,在onCreate裡面寫:mPullRefreshListView.setMode(Mode.BOTH);//設定你需要的模式

設定了模式為雙向都支援,當然必須為上拉和下拉分别設定回調,請看下面的代碼:

[java]  view plain copy

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
  1. package com.example.zhy_pulltorefreash_chenyoca;  
  2. import java.util.LinkedList;  
  3. import android.app.Activity;  
  4. import android.os.AsyncTask;  
  5. import android.os.Bundle;  
  6. import android.text.format.DateUtils;  
  7. import android.util.Log;  
  8. import android.widget.ArrayAdapter;  
  9. import android.widget.ListView;  
  10. import com.handmark.pulltorefresh.library.PullToRefreshBase;  
  11. import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;  
  12. import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;  
  13. import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener2;  
  14. import com.handmark.pulltorefresh.library.PullToRefreshListView;  
  15. public class PullToRefreshListActivity extends Activity  
  16. {  
  17.     private LinkedList<String> mListItems;  
  18.     private PullToRefreshListView mPullRefreshListView;  
  19.     private ArrayAdapter<String> mAdapter;  
  20.     private int mItemCount = 9;  
  21.     @Override  
  22.     protected void onCreate(Bundle savedInstanceState)  
  23.     {  
  24.         super.onCreate(savedInstanceState);  
  25.         setContentView(R.layout.activity_main);  
  26.         // 得到控件  
  27.         mPullRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);  
  28.         mPullRefreshListView.setMode(Mode.BOTH);  
  29.         // 初始化資料  
  30.         initDatas();  
  31.         // 設定擴充卡  
  32.         mAdapter = new ArrayAdapter<String>(this,  
  33.                 android.R.layout.simple_list_item_1, mListItems);  
  34.         mPullRefreshListView.setAdapter(mAdapter);  
  35.         mPullRefreshListView  
  36.                 .setOnRefreshListener(new OnRefreshListener2<ListView>()  
  37.                 {  
  38.                     @Override  
  39.                     public void onPullDownToRefresh(  
  40.                             PullToRefreshBase<ListView> refreshView)  
  41.                     {  
  42.                         Log.e("TAG", "onPullDownToRefresh");  
  43.                         //這裡寫下拉重新整理的任務  
  44.                         new GetDataTask().execute();  
  45.                     }  
  46.                     @Override  
  47.                     public void onPullUpToRefresh(  
  48.                             PullToRefreshBase<ListView> refreshView)  
  49.                     {  
  50.                         Log.e("TAG", "onPullUpToRefresh");  
  51.                         //這裡寫上拉加載更多的任務  
  52.                         new GetDataTask().execute();  
  53.                     }  
  54.                 });  
  55.     }  
  56.     private void initDatas()  
  57.     {  
  58.         // 初始化資料和資料源  
  59.         mListItems = new LinkedList<String>();  
  60.         for (int i = 0; i < mItemCount; i++)  
  61.         {  
  62.             mListItems.add("" + i);  
  63.         }  
  64.     }  
  65.     private class GetDataTask extends AsyncTask<Void, Void, String>  
  66.     {  
  67.         @Override  
  68.         protected String doInBackground(Void... params)  
  69.         {  
  70.             try  
  71.             {  
  72.                 Thread.sleep(2000);  
  73.             } catch (InterruptedException e)  
  74.             {  
  75.             }  
  76.             return "" + (mItemCount++);  
  77.         }  
  78.         @Override  
  79.         protected void onPostExecute(String result)  
  80.         {  
  81.             mListItems.add(result);  
  82.             mAdapter.notifyDataSetChanged();  
  83.             // Call onRefreshComplete when the list has been refreshed.  
  84.             mPullRefreshListView.onRefreshComplete();  
  85.         }  
  86.     }  

和第一段的代碼隻有一個地方有差別,可能很難發現:

mPullRefreshListView.setOnRefreshListener(new OnRefreshListener2<ListView>(){});注意這裡的接口類型是OnRefreshListener2,多了個2,和上面的不一樣,這個接口包含兩個方法,一個上拉回調,一個下拉回調。好了,這樣我們就成功添加了上拉與下拉,并且分别可以控制其回調代碼。

效果圖:

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解

咋樣,是不是也很簡單~注:如果你的上拉和下拉需求是執行一樣的代碼,那麼你可以繼續注冊OnRefreshListener接口,上拉和下拉都會執行同一個方法。

接下來介紹如何使用帶下拉重新整理和加載更多的的GridView和自定義樣式~

3、帶下拉和上拉的GridView ( PullToRefreshGridView )

同樣的pull-to-refresh把GridView封裝為:PullToRefreshGridView 。用法和PullToRefreshListView一摸一樣~

首先看主布局檔案:

[html]  view plain copy

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:layout_width="fill_parent"  
  4.     android:layout_height="fill_parent"  
  5.     android:orientation="vertical" >  
  6.     <!-- The PullToRefreshGridView replaces a standard GridView widget. -->  
  7.     <com.handmark.pulltorefresh.library.PullToRefreshGridView  
  8.         xmlns:ptr="http://schemas.android.com/apk/res-auto"  
  9.         android:id="@+id/pull_refresh_grid"  
  10.         android:layout_width="fill_parent"  
  11.         android:layout_height="fill_parent"  
  12.         android:columnWidth="100dp"  
  13.         android:gravity="center_horizontal"  
  14.         android:horizontalSpacing="1dp"  
  15.         android:numColumns="auto_fit"  
  16.         android:stretchMode="columnWidth"  
  17.         android:verticalSpacing="1dp"  
  18.         ptr:ptrDrawable="@drawable/ic_launcher"  
  19.         ptr:ptrMode="both" />  
  20. </LinearLayout>  

PullToRefreshGridView 的item的布局檔案:

[html]  view plain copy

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <TextView xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:id="@+id/id_grid_item_text"  
  4.     android:layout_width="100dp"  
  5.     android:gravity="center"  
  6.     android:textColor="#ffffff"  
  7.     android:textSize="16sp"  
  8.     android:background="#000000"  
  9.     android:layout_height="100dp" />  

接下來就是Activity的代碼了:

[java]  view plain copy

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
  1. public class PullToRefreshGridActivity extends Activity  
  2. {  
  3.     private LinkedList<String> mListItems;  
  4.     private PullToRefreshGridView mPullRefreshListView;  
  5.     private ArrayAdapter<String> mAdapter;  
  6.     private int mItemCount = 10;  
  7.     @Override  
  8.     protected void onCreate(Bundle savedInstanceState)  
  9.     {  
  10.         super.onCreate(savedInstanceState);  
  11.         setContentView(R.layout.activity_ptr_grid);  
  12.         // 得到控件  
  13.         mPullRefreshListView = (PullToRefreshGridView) findViewById(R.id.pull_refresh_grid);  
  14.         // 初始化資料和資料源  
  15.         initDatas();  
  16.         mAdapter = new ArrayAdapter<String>(this, R.layout.grid_item,  
  17.                 R.id.id_grid_item_text, mListItems);  
  18.         mPullRefreshListView.setAdapter(mAdapter);  
  19.         mPullRefreshListView  
  20.                 .setOnRefreshListener(new OnRefreshListener2<GridView>()  
  21.                 {  
  22.                     @Override  
  23.                     public void onPullDownToRefresh(  
  24.                             PullToRefreshBase<GridView> refreshView)  
  25.                     {  
  26.                         Log.e("TAG", "onPullDownToRefresh"); // Do work to  
  27.                         String label = DateUtils.formatDateTime(  
  28.                                 getApplicationContext(),  
  29.                                 System.currentTimeMillis(),  
  30.                                 DateUtils.FORMAT_SHOW_TIME  
  31.                                         | DateUtils.FORMAT_SHOW_DATE  
  32.                                         | DateUtils.FORMAT_ABBREV_ALL);  
  33.                         // Update the LastUpdatedLabel  
  34.                         refreshView.getLoadingLayoutProxy()  
  35.                                 .setLastUpdatedLabel(label);  
  36.                         new GetDataTask().execute();  
  37.                     }  
  38.                     @Override  
  39.                     public void onPullUpToRefresh(  
  40.                             PullToRefreshBase<GridView> refreshView)  
  41.                     {  
  42.                         Log.e("TAG", "onPullUpToRefresh"); // Do work to refresh  
  43.                                                             // the list here.  
  44.                         new GetDataTask().execute();  
  45.                     }  
  46.                 });  
  47.     }  
  48.     private void initDatas()  
  49.     {  
  50.         mListItems = new LinkedList<String>();  
  51.         for (int i = 0; i < mItemCount; i++)  
  52.         {  
  53.             mListItems.add(i + "");  
  54.         }  
  55.     }  
  56.     private class GetDataTask extends AsyncTask<Void, Void, Void>  
  57.     {  
  58.         @Override  
  59.         protected Void doInBackground(Void... params)  
  60.         {  
  61.             try  
  62.             {  
  63.                 Thread.sleep(2000);  
  64.             } catch (InterruptedException e)  
  65.             {  
  66.             }  
  67.             return null;  
  68.         }  
  69.         @Override  
  70.         protected void onPostExecute(Void result)  
  71.         {  
  72.             mListItems.add("" + mItemCount++);  
  73.             mAdapter.notifyDataSetChanged();  
  74.             // Call onRefreshComplete when the list has been refreshed.  
  75.             mPullRefreshListView.onRefreshComplete();  
  76.         }  
  77.     }  

基本上上例沒有任何差別,直接看效果圖吧:

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解

效果還是不錯的,如果你比較細心會發現,那個下拉重新整理的轉圈的圖檔咋變成機器人了,那是因為我在布局檔案裡面設定了:

[html]  view plain copy

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
  1. <com.handmark.pulltorefresh.library.PullToRefreshGridView  
  2.        ptr:ptrDrawable="@drawable/ic_launcher"  
  3.        ...  
  4.        />  

當然了這是旋轉的效果,一般常用的還有,一個箭頭倒置的效果,其實也很簡單,一個屬性:

ptr:ptrAnimationStyle="flip"

去掉 ptr:ptrDrawable="@drawable/ic_launcher"這個屬性,如果你希望用下圖預設的箭頭,你也可以自定義。

添加後,箭頭就是這個樣子:

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解

ptr:ptrAnimationStyle的取值:flip(翻轉動畫), rotate(旋轉動畫) 。 

ptr:ptrDrawable則就是設定圖示了。

4、自定義下拉訓示器文本内容等效果

可以在初始化完成mPullRefreshListView後,通過mPullRefreshListView.getLoadingLayoutProxy()可以得到一個ILoadingLayout對象,這個對象可以設定各種訓示器中的樣式、文本等。

[java]  view plain copy

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
  1. ILoadingLayout startLabels = mPullRefreshListView  
  2.                 .getLoadingLayoutProxy();  
  3.         startLabels.setPullLabel("你可勁拉,拉...");// 剛下拉時,顯示的提示  
  4.         startLabels.setRefreshingLabel("好嘞,正在重新整理...");// 重新整理時  
  5.         startLabels.setReleaseLabel("你敢放,我就敢重新整理...");// 下來達到一定距離時,顯示的提示  

如果你比較細心,會發現,前面我們設定上次重新整理時間已經用到了:

// Update the LastUpdatedLabel

refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);

現在的效果是:

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解

預設是上拉和下拉的字同時改變的,如果我希望單獨改變呢?

[java]  view plain copy

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解
  1. private void initIndicator()  
  2.     {  
  3.         ILoadingLayout startLabels = mPullRefreshListView  
  4.                 .getLoadingLayoutProxy(true, false);  
  5.         startLabels.setPullLabel("你可勁拉,拉...");// 剛下拉時,顯示的提示  
  6.         startLabels.setRefreshingLabel("好嘞,正在重新整理...");// 重新整理時  
  7.         startLabels.setReleaseLabel("你敢放,我就敢重新整理...");// 下來達到一定距離時,顯示的提示  
  8.         ILoadingLayout endLabels = mPullRefreshListView.getLoadingLayoutProxy(  
  9.                 false, true);  
  10.         endLabels.setPullLabel("你可勁拉,拉2...");// 剛下拉時,顯示的提示  
  11.         endLabels.setRefreshingLabel("好嘞,正在重新整理2...");// 重新整理時  
  12.         endLabels.setReleaseLabel("你敢放,我就敢重新整理2...");// 下來達到一定距離時,顯示的提示  
  13.     }  

mPullRefreshListView.getLoadingLayoutProxy(true, false);接收兩個參數,為true,false傳回設定下拉的ILoadingLayout;為false,true傳回設定上拉的。

5、常用的一些屬性

當然了,pull-to-refresh在xml中還能定義一些屬性:

ptrMode,ptrDrawable,ptrAnimationStyle這三個上面已經介紹過。

ptrRefreshableViewBackground 設定整個mPullRefreshListView的背景色

ptrHeaderBackground 設定下拉Header或者上拉Footer的背景色

ptrHeaderTextColor 用于設定Header與Footer中文本的顔色

ptrHeaderSubTextColor 用于設定Header與Footer中上次重新整理時間的顔色

ptrShowIndicator如果為true會在mPullRefreshListView中出現icon,右上角和右下角,挺有意思的。

ptrHeaderTextAppearance , ptrSubHeaderTextAppearance分别設定拉Header或者上拉Footer中字型的類型顔色等等。

ptrRotateDrawableWhilePulling當動畫設定為rotate時,下拉是是否旋轉。

ptrScrollingWhileRefreshingEnabled重新整理的時候,是否允許ListView或GridView滾動。覺得為true比較好。

ptrListViewExtrasEnabled 決定了Header,Footer以何種方式加入mPullRefreshListView,true為headView方式加入,就是滾動時重新整理頭部會一起滾動。

最後2個其實對于使用者體驗還是挺重要的,如果設定的時候考慮下~。其他的屬性自己選擇就好。

注:上述屬性很多都可以代碼控制,如果有需要可以直接mPullRefreshListView.set屬性名 檢視

以上為pull-to-refresh所有支援的屬性~~

定義了一堆的效果:

Android PullToRefresh (ListView GridView 下拉重新整理) 使用詳解

右上、右下那個圖示就是ptrShowIndicator。好了,大家可以按照自己的需求對着上面的屬性解釋配置。

在github上下載下傳的例子,是依賴3個項目的,一個基本的library_pullToRefresh,一個PullToRefreshViewPager,一個PullToRefreshListFragment ;

上面介紹的例子隻依賴library_pullToRefresh,其他兩個依賴不用導入。

源碼點選下載下傳

繼續閱讀