允许上下两方向刷新的SwipeRefreshLayout扩展。
To include in your project, add this to your build.gradle file:
//SwipyRefreshLayout compile 'com.github.orangegangsters:swipy:1.1.0@aar'
Usage
If you want an example on how to use it, you can find an example app in this repo.
<com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout android:id="@+id/swipyrefreshlayout" android:layout_width="wrap_content" android:layout_height="wrap_content" app:direction="both"> <ListView android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="match_parent" /> </com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout>
mSwipyRefreshLayout.setOnRefreshListener(new SwipyRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh(SwipyRefreshLayoutDirection direction) {
Log.d("MainActivity", "Refresh triggered at "
+ (direction == SwipyRefreshLayoutDirection.TOP ? "top" : "bottom"));
}
});
Customization
- XML:
app:direction="top"
OR
app:direction="bottom"
OR
app:direction="both"
- Programmatically:
mSwipyRefreshLayout.setDirection(SwipyRefreshLayoutDirection.TOP);
OR
mSwipyRefreshLayout.setDirection(SwipyRefreshLayoutDirection.BOTTOM);
OR
mSwipyRefreshLayout.setDirection(SwipyRefreshLayoutDirection.BOTH);
项目主页:http://www.open-open.com/lib/view/home/1426140864170
转载地址:http://www.open-open.com/lib/view/open1426140864170.html