Android-设置PullToRefresh下拉刷新样式
来源:互联网 发布:淘宝哪家韩妆店最优惠 编辑:程序博客网 时间:2024/06/07 09:40
Android-设置PullToRefresh下拉刷新样式
以下是开源控件PullToRefresh的自定义样式属性:
- <?xml version="1.0" encoding="utf-8"?>
- <resources>
- <declare-styleable name="PullToRefresh">
-
-
- <attr name="ptrRefreshableViewBackground" format="reference|color" />
-
-
- <attr name="ptrHeaderBackground" format="reference|color" />
-
-
- <attr name="ptrHeaderTextColor" format="reference|color" />
-
-
- <attr name="ptrHeaderSubTextColor" format="reference|color" />
-
- <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" />
-
-
- <flag name="pullDownFromTop" value="0x1" />
- <flag name="pullUpFromBottom" value="0x2" />
- </attr>
-
-
- <attr name="ptrShowIndicator" format="reference|boolean" />
-
-
- <attr name="ptrDrawable" format="reference" />
-
-
- <attr name="ptrDrawableStart" format="reference" />
-
-
-
- <attr name="ptrDrawableEnd" format="reference" />
-
- <attr name="ptrOverScroll" format="reference|boolean" />
-
-
- <attr name="ptrHeaderTextAppearance" format="reference" />
-
- <attr name="ptrSubHeaderTextAppearance" format="reference" />
-
- <attr name="ptrAnimationStyle">
- <flag name="rotate" value="0x0" />
- <flag name="flip" value="0x1" />
- </attr>
-
-
- <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" />
-
- <attr name="ptrAdapterViewBackground" format="reference|color" />
- <attr name="ptrDrawableTop" format="reference" />
- <attr name="ptrDrawableBottom" format="reference" />
- </declare-styleable>
- </resources>
可以在布局文件中设置自定义的这些样式,使用方法如下:
- <com.handmark.pulltorefresh.libaray xmlns:ptr="http://schemas.android.com/apk/res-auto"
- android:id="@+id/lv"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/white"
- android:cacheColorHint="#00000000"
- android:divider="@drawable/border"
- android:fadingEdge="none"
- android:fadingEdgeLength="0dip"
- android:scrollbars="none"
- android:scrollingCache="true"
- ptr:ptrDrawable="@drawable/infzm_logo"
- />
注意:需要声明命名空间:xmlns:ptr=http://schemas.android.com/apk/res-auto
使用自定义属性:ptr:ptrDrawable="@drawable/logo"
其他属性使用方法类似。
1 0