Android 下拉重新整理,非常強大的下拉重新整理功能

2021-07-26 18:56:09 字數 2164 閱讀 6820

android下拉重新整理各式各樣,今天介紹兩種常見的

第一種下拉重新整理就是android自帶api ,v4包下面的

android

.support.v4.widget.swiperefreshlayout

只要將要重新整理的控制項放到swiperefreshlayout  裡面

比如:

android

:id=

"@+id/swiperefreshlayout"

android

:layout_width=

"match_parent"

android

:layout_height=

"match_parent"

>

android

:id=

"@+id/rv"

android

:layout_width=

"match_parent"

android

:layout_height=

"match_parent"

>

然後再**裡面

mswiperefreshlayout = (swiperefreshlayout) findviewbyid(r.id.swiperefreshlayout);
mswiperefreshlayout.setonrefreshlistener(new swiperefreshlayout.onrefreshlistener() mmyadapter.addheaderitem(headdatas);

//重新整理完成

mswiperefreshlayout.setrefreshing(false);

toast.maketext(mainactivity.this,

"更新了

" + headdatas.size() + "

條目資料

", toast.length_short).show();

} },

3000);

}});

第二種介紹第三方的下拉重新整理

首先

compile 'in.srain.cube:ultra-ptr:1.0.11'
應用一下

然後在布局檔案.xml加上

xmlns:

cube_ptr

=""android

:id=

"@+id/store_house_ptr_frame"

android

:layout_width=

"match_parent"

android

:layout_height=

"match_parent"

cube_ptr

:ptr_duration_to_close=

"300"

cube_ptr

:ptr_duration_to_close_header=

"800"

cube_ptr

:ptr_keep_header_when_refresh=

"true"

cube_ptr

:ptr_pull_to_fresh=

"false"

cube_ptr

:ptr_ratio_of_header_height_to_refresh=

"1.2"

cube_ptr

:ptr_resistance=

"1.7"

>

**裡面

mptrclassicframelayout = (ptrclassicframelayout) findviewbyid(r.id.store_house_ptr_frame);
mptrclassicframelayout.setptrhandler(new ptrhandler() 

}, 2000);

} @override

public boolean

checkcandorefresh(ptrframelayout frame, view content, view header)

});

既可以下拉重新整理,還可以修改第三方,變成產品要求的背景樣式.

Android下拉重新整理資料

通過下拉螢幕來實現重新整理資料,這裡展示了一種實現方式,swiperefreshlayout swiperefreshlayout swiperefreshlayout view.findviewbyid r.id srl class main 設定重新整理 小圈的顏色 swiperefreshla...

下拉重新整理 WEUI下拉重新整理

最近在做手機版使用到了下拉重新整理和滾動載入,記錄一下實現過程 一 引入檔案12 34 二 頁面布局12 3456 78910 1112 1314 1516 1718 19 下拉重新整理 釋放重新整理 正在重新整理 正在載入 三 js部分12 3456 78910 1112 1314 1516 17...

IOS UITableView下拉重新整理

給 uitableview 新增 下拉重新整理 pull refresh 屬性 親愛的,我還是有些不忍心,不過事情的經過是這樣的 cocoa touch 的 官方 sdk 裡,壓根就沒實現這個 pull refresh 的功能。恩,這事真不是賈伯斯手下幹的。然而也不是麻匪幹的。是他幹的,enorme...