`
l540151663
  • 浏览: 181046 次
  • 性别: Icon_minigender_1
  • 来自: 浙江
社区版块
存档分类
最新评论

Android下拉刷新上拉加载控件的使用

 
阅读更多
参考链接:http://www.jianshu.com/p/699e2662fc27

刷新控件:in.srain.cube.views.ptr.PtrFrameLayout 和com.chanven.lib.cptr.PtrClassicFrameLayout

导包:
compile 'in.srain.cube:ultra-ptr:1.0.11'

compile 'com.chanven.lib:cptr:1.0.0'

使用Xml文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.chanven.lib.cptr.PtrClassicFrameLayout
     android:id="@+id/test_list_view_frame"
     xmlns:cube_ptr="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="#f0f0f0"
     cube_ptr:ptr_resistance="1.7"
     cube_ptr:ptr_ratio_of_header_height_to_refresh="1.2"
     cube_ptr:ptr_duration_to_close="200"
     cube_ptr:ptr_duration_to_close_header="1000"
     cube_ptr:ptr_keep_header_when_refresh="true"
     cube_ptr:ptr_pull_to_fresh="false">

     <ListView
         android:id="@+id/test_list_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:background="@android:color/white"
         android:choiceMode="singleChoice"
         android:divider="#b0b0b0"
         android:dividerHeight="0.1dp"
         android:fadingEdge="none"
         android:scrollbarStyle="outsideOverlay"/>
</com.chanven.lib.cptr.PtrClassicFrameLayout>
</LinearLayout>

或者

<in.srain.cube.views.ptr.PtrFrameLayout
android:id="@+id/store_house_ptr_frame"
xmlns:cube_ptr="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
cube_ptr:ptr_resistance="1.7"
cube_ptr:ptr_ratio_of_header_height_to_refresh="1.2"
cube_ptr:ptr_duration_to_close="300"
cube_ptr:ptr_duration_to_close_header="2000"
cube_ptr:ptr_keep_header_when_refresh="true"
cube_ptr:ptr_pull_to_fresh="false" >
<LinearLayout
     android:id="@+id/store_house_ptr_image_content"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@color/cube_mints_333333"
     android:clickable="true"
     android:padding="10dp">
     <in.srain.cube.image.CubeImageView
         android:id="@+id/store_house_ptr_image"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />
</LinearLayout>
</in.srain.cube.views.ptr.PtrFrameLayout>

代码初始化:
        ptrClassicFrameLayout.setLoadMoreEnable(true);
        ptrClassicFrameLayout.setOnLoadMoreListener(this);
        ptrClassicFrameLayout.setPtrHandler(this);
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics