eclipse怎么使用swipyrefreshlayout
答案:1 悬赏:10 手机版
解决时间 2021-11-09 01:52
- 提问者网友:你挡着我发光了
- 2021-11-08 21:21
eclipse怎么使用swipyrefreshlayout
最佳答案
- 五星知识达人网友:玩家
- 2021-11-08 21:59
参考下面代码:
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/hello_world" />
然后是自己的代码:
public class FriendFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {
private SwipeRefreshLayout swipeLayout;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_friend, null);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
public void onDestroyView() {
super.onDestroyView();
}
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
swipeLayout.setRefreshing(false);
}
}, 5000);
}
}
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent" >
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/hello_world" />
然后是自己的代码:
public class FriendFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {
private SwipeRefreshLayout swipeLayout;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_friend, null);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
public void onDestroyView() {
super.onDestroyView();
}
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
swipeLayout.setRefreshing(false);
}
}, 5000);
}
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯