第三方包属性的定义(这里是以刷新库为例)
来源:互联网 发布:好看的悬疑网络剧 编辑:程序博客网 时间:2024/04/28 06:47
下面是以pulltorefresh内部的刷新库为例:
1.在xml布局内,使用方法如下:
<com.handmark.pulltorefresh.library.PullToRefreshScrollView xmlns:ptr="http://schemas.android.com/apk/res-auto" android:id="@+id/meet_story_main_scroll" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="none" android:layout_below="@+id/meet_title_bar" ptr:ptrHeaderBackground="#00ff00" ptr:ptrHeaderTextColor="@color/meet_gray_color" ptr:ptrListViewExtrasEnabled="false" ptr:ptrScrollingWhileRefreshingEnabled="true" />
2.它的文件在values文件夹下的atts.xml内:如下
<?xml version="1.0" encoding="utf-8"?><resources> <declare-styleable name="PullToRefresh"> <!-- A drawable to use as the background of the Refreshable View --> <attr name="ptrRefreshableViewBackground" format="reference|color" /> <!-- A drawable to use as the background of the Header and Footer Loading Views --> <attr name="ptrHeaderBackground" format="reference|color" /> <!-- Text Color of the Header and Footer Loading Views --> <attr name="ptrHeaderTextColor" format="reference|color" /> <!-- Text Color of the Header and Footer Loading Views Sub Header --> <attr name="ptrHeaderSubTextColor" format="reference|color" /> <!-- Mode of Pull-to-Refresh that should be used --> <attr name="ptrMode"> <flag name="disabled" value="0x0" /> <flag name="pullFromStart" value="0x1" /> <flag name="pullFromEnd" value="0x2" /> <flag name="both" value="0x3" /> <flag name="manualOnly" value="0x4" /> <!-- These last two are depreacted --> <flag name="pullDownFromTop" value="0x1" /> <flag name="pullUpFromBottom" value="0x2" /> </attr> <!-- Whether the Indicator overlay(s) should be used --> <attr name="ptrShowIndicator" format="reference|boolean" /> <!-- Drawable to use as Loading Indicator. Changes both Header and Footer. --> <attr name="ptrDrawable" format="reference" /> <!-- Drawable to use as Loading Indicator in the Header View. Overrides value set in ptrDrawable. --> <attr name="ptrDrawableStart" format="reference" /> <!-- Drawable to use as Loading Indicator in the Footer View. Overrides value set in ptrDrawable. --> <attr name="ptrDrawableEnd" format="reference" /> <!-- Whether Android's built-in Over Scroll should be utilised for Pull-to-Refresh. --> <attr name="ptrOverScroll" format="reference|boolean" /> <!-- Base text color, typeface, size, and style for Header and Footer Loading Views --> <attr name="ptrHeaderTextAppearance" format="reference" /> <!-- Base text color, typeface, size, and style for Header and Footer Loading Views Sub Header --> <attr name="ptrSubHeaderTextAppearance" format="reference" /> <!-- Style of Animation should be used displayed when pulling. --> <attr name="ptrAnimationStyle"> <flag name="rotate" value="0x0" /> <flag name="flip" value="0x1" /> </attr> <!-- Whether the user can scroll while the View is Refreshing --> <attr name="ptrScrollingWhileRefreshingEnabled" format="reference|boolean" /> <!-- Whether PullToRefreshListView has it's extras enabled. This allows the user to be able to scroll while refreshing, and behaves better. It acheives this by adding Header and/or Footer Views to the ListView. --> <attr name="ptrListViewExtrasEnabled" format="reference|boolean" /> <!-- Whether the Drawable should be continually rotated as you pull. This only takes effect when using the 'Rotate' Animation Style. --> <attr name="ptrRotateDrawableWhilePulling" format="reference|boolean" /> <!-- BELOW HERE ARE DEPRECEATED. DO NOT USE. --> <attr name="ptrAdapterViewBackground" format="reference|color" /> <attr name="ptrDrawableTop" format="reference" /> <attr name="ptrDrawableBottom" format="reference" /> </declare-styleable></resources>
在代码中也是可以写的,如下:
if (attrs.hasValue(R.styleable.PullToRefresh_ptrHeaderTextAppearance)) { TypedValue styleID = new TypedValue(); attrs.getValue(R.styleable.PullToRefresh_ptrHeaderTextAppearance, styleID); setTextAppearance(styleID.data); }
现在很多都是使用这种属性,了解一下操作起来很是方便。
1 0
- 第三方包属性的定义(这里是以刷新库为例)
- golang实践-第三方包为私有库的配置
- IOS-IOS集成第三方SDK包的时候可以适量缩小包的大小(shareSDK为例)
- 第三方库EGO刷新的使用
- MJRefresh刷新第三方库
- MJRefresh刷新第三方库
- android开发引入第三方Jar包---achartengine为例
- 如何引入第三方jar包(以google play service为例)
- 如何引入第三方jar包(以google play service为例)
- 如何引入第三方jar包(以google play service为例)
- 为应用添加第三方jar包
- 刷新APK调用第三方库的一个好方法
- <汇文教育>关于上拉下拉刷新第三方包SDRefresh的解读
- 自己写的下拉刷新的第三方库(适用于listview)
- 解决集成第三方库(这里是AdsMogo芒果聚合)时编译找不到某个语法的问题
- 【JAVA】将工程导出为含有第三方包的jar包
- 上下拉刷新之第三方库MJRefresh 的具体使用——(用于UITabView的数据刷新)
- 如何在项目中使用MJRefresh(刷新的第三方库)
- 多进程单线程模型与单进程多线程模型之争
- 四大组件之ContentProvider(二)-轻轻松松自定义ContentProvider
- nginx 和 tomcat 生产环境配置 建议和方法
- Eclipse中通过Tomcat运行J2EE项目java.lang.OutOfMemoryError: PermGen space的解决方案
- spring mvc数据绑定
- 第三方包属性的定义(这里是以刷新库为例)
- 使用VB6资源文件开发多国语言应用攻略
- 算法与数据结构描述
- position:absolute;的DIV 如何居中
- java构造树,多级菜单
- 计算二维空间某点的最近k 个点
- linux 时间服务器
- 我的MYSQL学习心得(十六) 优化
- 11 算术运算符与算术表达式