优酷5.01 上拉刷新SwipeRefreshLayout
2015-08-25 16:37
176 查看
原创文章,欢迎转载。转载请注明:http://blog.csdn.net/seven2729/article/details/47979263
最近更新优酷发现好炫的刷新,以为是自定义的,好看又酷,找了半天。原来是系统自带的,碉堡了。有兴趣的瞅瞅吧!
布局与viewpager的有点像,贴点代码
<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" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/but_two_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="11dp"
android:text="two_style"/>
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp" />
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
定义布局
private SwipeRefreshLayout mSwipeLayout;
在oncreat里面设置监听,太简单就不说了
mSwipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
mSwipeLayout.setOnRefreshListener(this);
// 设置下拉时的颜色
mSwipeLayout.setColorSchemeResources(R.color.color_bule,
R.color.color_bule, R.color.color_bule, R.color.color_bule);
/**
* do sth onRefresh
*/
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mSwipeLayout.setRefreshing(false);
}
}, 5000);
}
要是有需要的可以点击 下载源码
另附带之前上传的上拉刷新 资源
原创文章,欢迎转载。转载请注明:http://blog.csdn.net/seven2729/article/details/47979263
最近更新优酷发现好炫的刷新,以为是自定义的,好看又酷,找了半天。原来是系统自带的,碉堡了。有兴趣的瞅瞅吧!
布局与viewpager的有点像,贴点代码
<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" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/but_two_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="11dp"
android:text="two_style"/>
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp" />
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
定义布局
private SwipeRefreshLayout mSwipeLayout;
在oncreat里面设置监听,太简单就不说了
mSwipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
mSwipeLayout.setOnRefreshListener(this);
// 设置下拉时的颜色
mSwipeLayout.setColorSchemeResources(R.color.color_bule,
R.color.color_bule, R.color.color_bule, R.color.color_bule);
/**
* do sth onRefresh
*/
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mSwipeLayout.setRefreshing(false);
}
}, 5000);
}
要是有需要的可以点击 下载源码
另附带之前上传的上拉刷新 资源
原创文章,欢迎转载。转载请注明:http://blog.csdn.net/seven2729/article/details/47979263
相关文章推荐
- 四种强制类型转换的总结(const_cast、static_cast、dynamic_cast、reinterpreter_cast)
- Code(POJ--1850
- java 获取两个日期的相差天数
- DNS解析过程详解
- TWinControl的刷新过程(5个非虚函数,4个覆盖函数,1个消息函数,默认没有双缓冲,注意区分是TCustomControl还是Windows原生封装控件,执行流程不一样)
- JavaScript构造函数学习笔记
- Android meta-data(未完成)
- Android使用TextView实现无下划线超链接
- pjsip的simple_pjsua.c和simpleua.c分析
- 基本排序算法--堆排序
- MyBatis学习 之 二、SQL语句映射文件(2)增删改查、参数、缓存
- 如何修改linux 的SSH的默认端口号
- 数据结构之红黑树——BST的变种
- Win7 64位 + LoadRunner 11录制时弹不出IE的解决办法
- iOS----时间日期处理
- iOS UIWebView 通过 cookie 完成自动登录验证
- android的DrawerLayout用法
- struts2之文件上传
- 【POJ 3615】Cow Hurdles
- Android meta-data(未完成)