pulltorefresh(二)的自定义属性介绍、attrs文件介绍
2016-03-24 16:43
357 查看
上面一章,我们简介了PullToRefresh的使用了,我们都知道了,他是一个自定义的控件,基本上每个自定义控件的都会有自己的属性,我们这章介绍下他的有哪些属性,所有的自定义控件的属性,我们需要现在res/values/attrs.xml去声明下,我介绍下,这个自定义控件有哪些属性
以上就是他所有的属性了,具体怎么使用呢,我们只需要我们布局文件的头部加入:
然后就可以在pulltorefresh节点的xml文件使用它的属性,如:
<pre>
ptr:ptrMode="both"
这样,我们就设置了,这个pulltorefresh的模式是上拉下拉双支持的
<?xml version="1.0" encoding="utf-8"<span style="color: #0000ff;">?> <resources> <declare-styleable ;">name="PullToRefresh"> <!-- 设置刷新列表的背景色 --> <span>attr name="ptrRefreshableViewBackground" format="reference|color" /> <!-- 设置下拉Header或者上拉Footer的背景色 --> <attr name<span style="color: #0000ff;">="ptrHeaderBackground" format="reference|color" /> <!-- 用于设置Header与Footer中文本的颜色 --> <attr name="ptrHeaderTextColor" format"color: #0000ff;">="reference|color" /> <!-- 用于设置Header与Footer中上次刷新时间文本的颜色 --> <n>attr name="ptrHeaderSubTextColor" format="reference|color" /> <span style="color: #008000;"><!-- 刷新模式 --> <attr name="ptrMode"> <flag name="disabled" value0000ff;">="0x0" /> <!-- 禁用下拉刷新 --> <flag <span style="color: #ff0000;">name="pullFromStart" value="0x1" /> <!-- 仅支持下拉刷新 --> <flag name="pullFromEnd" valueor: #0000ff;">="0x2" /> <!-- 仅支持上拉刷新 --> <flag >name="both" value="0x3" /> <!-- 上拉刷新和下拉刷新都支持 --> <flag name="manualOnly" valuelor: #0000ff;">="0x4" /> <!-- 只允许手动触发 --> <!-- These last two are depreacted --> <flag name="pullDownFromTop" value="0x1" /> <flag name="pullUpFromBottom"<span style="color: #ff0000;"> value="0x2" /> </attr> <!-- 如果为true会在mPullRefreshListView中出现icon,右上角和右下角,挺有意思的 --> <attr name;">="ptrShowIndicator" format="reference|boolean" /> <!-- 同时改变头部和底部的刷新图标 #008000;">--> <attr name="ptrDrawable" format="reference"> /> <!-- 头部视图的刷新图标 --> <attr : #ff0000;">name="ptrDrawableStart" format="reference" /> <!-- 底部视图的刷新图标 --> <attr name="ptrDrawableEnd" format<span style="color: #0000ff;">="reference" /> <attr name="ptrOverScroll"<span > format="reference|boolean" /> <!-- 分别设置拉Header或者上拉Footer中字体的类型颜色等等 --> <span style="color: #0000ff;"><attr name="ptrHeaderTextAppearance" format="reference" ;">/> <attr name="ptrSubHeaderTextAppearance" format="reference" /> <!-- flip(翻转动画), rotate(旋转动画) --> <attr pan>name="ptrAnimationStyle"> <flag name #0000ff;">="rotate" value="0x0" /> <flag name<span style="color: #0000ff;">="flip" value="0x1" /> </attr>> <!-- 刷新的时候,是否允许ListView或GridView滚动 --> <attr name="ptrScrollingWhileRefreshingEnabled" format="reference|boolean" /> <!--"> 决定了Header,Footer以何种方式加入mPullRefreshListView,true为headView方式加入,就是滚动时刷新头部会一起滚动,false不能刷新 --> <attr namef;">="ptrListViewExtrasEnabled" format="reference|boolean" /> <!-- 拉的时候头部或者尾部的刷新图片,是否多次旋转,true多次,false只是旋转一周,在下拉,图片不会在跟着旋转 --> <attr name="ptrRotateDrawableWhilePulling"000;"> format="reference|boolean" /> <!-- BELOW HERE ARE DEPRECEATED. DO NOT USE. --> <attr name="ptrAdapterViewBackground" format="reference|color" <span style="color: #0000ff;">/> <attr name="ptrDrawableTop" format="reference" /> <attr name="ptrDrawableBottom" format<span style="color: #0000ff;">="reference" /> </declare-styleable> </00;">resources>
以上就是他所有的属性了,具体怎么使用呢,我们只需要我们布局文件的头部加入:
xmlns:ptr="http://schemas.android.com/apk/res-auto"
然后就可以在pulltorefresh节点的xml文件使用它的属性,如:
<pre>
ptr:ptrMode="both"
这样,我们就设置了,这个pulltorefresh的模式是上拉下拉双支持的
相关文章推荐
- [Android]ListView中分割线的设置
- iOS App集成Apple Pay 编程指南
- 我的C++第二次实验报告
- shell命令详解
- 自定义消息弹出框的一个很不错的实例
- poj2243 bfs
- 【Linux】linux bash shell之变量替换::=句法、=句法、:-句法、-句法、=?句法、?句法、:+句法、+句法
- 较详细的介绍JNI
- python操作sqlite3的几项问题分析
- 解决libssl.so.1.0.0: 找不到的问题
- 安卓计算器实现_综述(一)
- window64位环境下redis的安装和使用(1)
- 随笔:弱类型语言javascript中 a,b 的运算
- 使用事务操作SQLite数据批量插入
- 清除plist文件
- css常用伪类记录
- thinkphp设置session有效时间
- 0c-41-ARC下循环引用问题
- 110-e-Balanced Binary Tree
- 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析