知识点
相关文章
更多最近更新
更多最简单下拉刷新,Google最新(可刷新任何控件)
2019-03-02 23:41|来源: 网路
main_activity.xml代码:
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</android.support.v4.widget.SwipeRefreshLayout>
MainActivity.java
/*
* Created by Storm Zhang, Mar 31, 2014.
*/
package com.storm.swiperefreshlayoutdemo;
import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout;
import android.widget.ListView;
public class MainActivity extends Activity implements SwipeRefreshLayout.OnRefreshListener {
private SwipeRefreshLayout swipeLayout;
private ListView listView;
private ListViewAdapter adapter;
private ArrayList<SoftwareClassificationInfo> list;
@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
swipeLayout.setOnRefreshListener(this);
swipeLayout.setColorScheme(android.R.color.holo_blue_bright, android.R.color.holo_green_light,
android.R.color.holo_orange_light, android.R.color.holo_red_light);
list = new ArrayList<SoftwareClassificationInfo>();
list.add(new SoftwareClassificationInfo(1, "asdas"));
listView = (ListView) findViewById(R.id.list);
adapter = new ListViewAdapter(this, list);
listView.setAdapter(adapter);
}
@override
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
public void run() {
swipeLayout.setRefreshing(false);
list.add(new SoftwareClassificationInfo(2, "ass"));
adapter.notifyDataSetChanged();
}
}, 1000);
}
}
转自:http://www.cnblogs.com/ws5861/p/3651585
相关问答
更多-
android webview怎么实现下拉刷新[2022-02-21]
Android系统已经提供了一个下拉刷新的控件了 SwipeRefreshLayout 这个在类V4包中,google源生的,用法超简单,两行代码搞定了 你用SwipeRefreshLayout包裹你的WebView即可实现下接刷新了 -
微信小程序有下拉刷新功能,怎么取消下拉刷新?[2024-01-15]
方法: 在页面的json 里面配置 : { "enablePullDownRefresh": false}就可以了。 全面开放申请后,主体类型为企业、政府、媒体、其他组织或个人的开发者,均可申请注册小程序。小程序、订阅号、服务号、企业号是并行的体系。 计算机程序(Computer Program),港、台译做电脑程式。一般的,计算机程序是指以某些程序设计语言编写,运行于某种目标结构体系上。 为了使计算机程序得以运行,计算机需要加载代码,同时也要加载数据。从计算机的底层来说,这是由高级语言(例如Java,C/ ... -
android studio 怎么下拉刷新上啦加载[2023-06-05]
在实际开发中,为了节省开发周期,下拉刷新上拉加载通常都会采取使用一些第三方库,典型的就是用PullToRefresh,XListView等等,还有就是谷歌推荐的SwipeRefreshLayout,可惜没有上拉加载功能,需要自己去实现一个上拉加载的脚View,再加上现在代替ListView的RecyclerView+CardView使用的频率也是也来也高,不得不说,CardView效果确实很好看,一个一个的小卡片,用户体验好,I like it!!!废话不说了,奔主题!今天也玩了一下SwipeRefresh ... -
android swiperefreshlayout怎么禁止下拉刷新?[2022-03-17]
不要下拉刷新直接不用它不就完了 或者试试setEnabled(false Google提供了一个官方的下拉刷新控件SwipeRefreshLayout,个人感觉还不错!见惯了传统的下拉刷新,这个反而给人耳目一新的感觉(Gmail邮箱已经使用这种下拉刷新了)。 SwipeRefreshLayout在V4包下,对应的V4 Demo中也有相应的例子。 SwipeRefreshLayout只能有一个直接子View,可能是一个ListView或一个Layout或其他需要刷新的组件。 setOnRefreshListe ... -
android listview怎么下拉刷新[2024-04-19]
public void onScrollStateChanged(AbsListView view, int scrollState) { if (listResource.getLastVisiblePosition() < (listResource .getCount() - 1)) { 做加载相关工作 } -
android 在ScrollView里嵌套一个带下拉刷新的ListView[2022-05-04]
你这策略不对啊,scollview套个imageview 和了listview做什么, imageview 不能放外边么 -
最新开通快手实验室教程 直播权限?[2022-02-22]
简单 -
private bool _isListRefreshing; ///
/// List of Messages, to be bound to the view /// public bool IsListRefreshing { get { return _isListRefreshing; } set { Set(() => IsListRefreshing, ref _isListRefreshing, value); } } 使用IsRe ... -
使用jQuery Ajax yourfile.php
下拉列表刷新(Dropdown list Refresh)[2022-09-08]
如果为窗口提供名称和替换标志(在window.open方法中),则不会在其他窗口中打开相同的URL。 你可以参考这个 。 If you provide name and replace flag to the window (in window.open method), it won't open the same URL in the other window. You can refer this.