studio到入桌面框架gridView上拉刷新下拉加载目录下PullRefreshLibrary框架
//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"
>
<com.handmark.pulltorefresh.library.PullToRefreshScrollView
android:id="@+id/f0_pullscrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:scaleType="fitXY"
android:src="@mipmap/ll_bg3"/>
<com.zmy.friendsmyapp.main2.Fragment.Luck.MYGirdview.MY_GridView.MyGridView
android:id="@+id/f0_pullgridview"
android:layout_width="match_parent"
android:layout_height="490dp"
android:numColumns="3"
>
</com.zmy.friendsmyapp.main2.Fragment.Luck.MYGirdview.MY_GridView.MyGridView>
</LinearLayout>
</com.handmark.pulltorefresh.library.PullToRefreshScrollView>
</LinearLayout>
//main
//自定义的gridView
f0_mygridView = (MyGridView) view.findViewById(R.id.f0_pullgridview);
//scrollview
f0_pullscrollview = (PullToRefreshScrollView) view.findViewById(R.id.f0_pullscrollview);
adapter = new Myf0Grid_Adapter(getActivity());
f0_mygridView.setAdapter(adapter);
//设置滚动监听
f0_pullscrollview.setMode(PullToRefreshBase.Mode.BOTH);
f0_pullscrollview.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ScrollView>() {
@Override
public void onPullDownToRefresh(PullToRefreshBase<ScrollView> refreshView) {
userList1.clear();
currPage=1;
// currPage++;
getIonInfo_luck();
//停止刷新
f0_pullscrollview.onRefreshComplete();
}
@Override
public void onPullUpToRefresh(PullToRefreshBase<ScrollView> refreshView) {
currPage++;
getIonInfo_luck();
//停止刷新
f0_pullscrollview.onRefreshComplete();
}
});