国外源码精品-Android-PullToRefresh 简介与DEMO导入
转载地址:http://my.oschina.net/cuitongliang/blog/170708
(一)&&http://my.oschina.net/cuitongliang/blog/170737
(二)PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED
一、介绍
Pull To Refresh Views for Android
This project aims to provide a reusable Pull to Refresh widget for Android. It was originally based on Johan Nilsson's library (mainly for graphics, strings and animations), but these have been replaced since.
- Supports both Pulling Down from the top, and Pulling Up from the bottom (or even both).
- Animated Scrolling for all devices.
- Over Scroll supports for devices on Android v2.3+.
- Currently works with:
- ListView
- ExpandableListView
- GridView
- WebView
- ScrollView
- HorizontalScrollView
- ViewPager
- Integrated End of List Listener for use of detecting when the user has scrolled to the bottom.
- Maven Support.
- Indicators to show the user when a Pull-to-Refresh is available.
- Support for ListFragment!
- Lots of Customisation options!
Repository at https://github.com/chrisbanes/Android-PullToRefresh.
附源码截图:
ListView ExpandableListView
GridView WebView
ScrollView Horizontal ScrollView
ViewPager ListView Fragment
WebView Advanced ListView in ViewPager
二、DEMO导入
很多人看到有好源码,但是在使用时碰到了问题。在此简单介绍一下,希望能够对那些不会的童鞋们有所帮助。
首先下载源码,源码地址:https://github.com/chrisbanes/Android-PullToRefresh。
下载完源码之后,解压。在Android-PullToRefresh-master文件夹下,我们会看到还有三个文件夹:extras,
library,sample。其中sample就是作者为我们提供的Demo,library是我们在使用Sample必须用到的jar。extras中是使用ListFragment和ViewPage用到的jar。讲解完目录后现在开始导入了。
1. 导入library:导入很简单,如图,点击finish即可。
导入之后没有问题。OK!
2. 同样导入extras中的PullToRefreshListFragment和PullToRefreshViewPager工程。切记:分别导入。
如图:
导入之后,你会发现工程报错了,很简单,没有关联libraray。右键工程--选择Properties,打开之后会发现有个红色的X,这就是报错的原因。改了就可以。
选中红色的报错的library,点击Remove,再点击Add,将Libarary添加上即可!如图:
同理将PullToRefreshViewPager工程的library也修改好。
3. 导入Sample工程,同时修改library。如图:
至此,工程全部导入,错误全部解决。
运行一下,看是否能够正常运行到手机上。接下来就可以慢慢研究着精品源码吧!
感谢原作者详细的讲解,解决了我的问题!
三、DEMO导入出现问题及解决
一、运行报错:Unable to execute dex: Multiple dex files define Lcom/my/cop/miles/R$anim