Skip to content
This repository was archived by the owner on Oct 15, 2018. It is now read-only.

Customisation

Chris Banes edited this page Oct 17, 2012 · 9 revisions

Customisation

There are a number of ways to customise the way that PullToRefresh behaves and looks.

XML Attributes

There are a number of XML attributes you can use, the best way is to look at the attrs.xml file. Here I'll give a quick overview of the main ones:

  • ptrAdapterViewBackground. Background to the AdapterView.
  • ptrHeaderBackground. Background of the Header/Footer Views.
  • ptrHeaderTextColor. Text Colour of the top line of text in the Header/Footer Views.
  • ptrHeaderSubTextColor. Text Colour of the bottom line of text in the Header/Footer Views.
  • ptrMode. Sets the Mode in which the Views will operate. Values are either pullDownFromTop, pullUpFromBottom or both. Defaults to pullDownFromTop.
  • ptrShowIndicator. Whether to show the Indicators showing the user whether a Pull-to-Refresh is possible. Defaults to true.
  • ptrDrawable. Drawable to show in the Header/Footer Views. Defaults to a refresh icon.
  • ptrOverScroll. Whether OverScroll support is enabled. Only takes affect when running on Android v2.3+ Defaults to true.
  • ptrHeaderTextAppearance. Sets the TextAppearance attribute on the upper TextView.
  • ptrSubHeaderTextAppearance. Sets the TextAppearance attribute on the lower TextView.
  • ptrAnimationStyle. Sets the animation style used. Valid options are: [rotate, flip]. You can find more information about this below.

Method Calls

There are also a number of methods available, most of which accompany the XML attributes above. The easiest way to see these is by looking at the interface source file. This contains all of the PullToRefresh related methods, and their Javadoc:

IPullToRefresh.java


Animation Style

The animation style controls how the Pull-to-Refresh functionality is presented to the user. The different options are:

Rotate (default)

Rotate Animation Screenshot

Rotate is the default as it allows you to make easy customisations to the look and feel by changing the Drawable used. The Drawable is rotated based on how far the user pulls, and is then continuously rotated while refreshing. Most of the samples use this option.

Flip

Flip Animation Screenshot

Flip is the old style animation, and is what is commonly used by applications on iOS. The arrow flips and changes direction based on how far the user has pulled. When refreshing, a Progress Bar is displayed instead. You can see a this in the ScrollView sample.

Clone this wiki locally