国外源码精品-Android-PullToRefresh 简介与DEMO导入
2013-12-05 12:23
591 查看
转载地址:/article/3566190.html (一)&&/article/3566191.html (二)
PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED
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.
Features
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
首先下载源码,源码地址: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。如图:
至此,工程全部导入,错误全部解决。
运行一下,看是否能够正常运行到手机上。接下来就可以慢慢研究着精品源码吧!
感谢原作者详细的讲解,解决了我的问题!
Lcom/my/cop/miles/R$anim
导致原因:
1、在ADT编译器和SDK的工具有差异或是版本不一致时常会出现
2、引用的两个子项目有相同的包名也会导致这个问题(引用多余的jar包,包出现冲突)
解决方案:
Eclipse ——> Project ——> 去掉自动构建(Build Automatically)——> 选择project中的clear ——> 选择project中的Build Project ——>启动自动构建(Build Automatically)
PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED
一、介绍
Pull To Refresh Views for AndroidThis 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.
Features
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 defineLcom/my/cop/miles/R$anim
导致原因:
1、在ADT编译器和SDK的工具有差异或是版本不一致时常会出现
2、引用的两个子项目有相同的包名也会导致这个问题(引用多余的jar包,包出现冲突)
解决方案:
Eclipse ——> Project ——> 去掉自动构建(Build Automatically)——> 选择project中的clear ——> 选择project中的Build Project ——>启动自动构建(Build Automatically)
相关文章推荐
- 国外源码精品-Android-PullToRefresh 简介与DEMO导入
- Android Studio导入Android系统源码
- Ubuntu12.04下Android Studio导入Android源码
- 向eclipse中导入android自带的demo
- Eclipse导入Android源码
- Android导入从SDK Manager下载的源码
- Macbook Pro下载并编译Android源码并导入Android Studio
- 如何把下载的Android源码文件夹直接批量导入Eclipse
- eclipse下导入android源码
- android studio怎样导入android源码
- Android-UI 超级优良超级多超级强大开源控件源码demo
- Android 二维码 生成和识别(附Demo源码)
- Android开发之在程序中时时获取logcat日志信息的方法(附demo源码下载)
- Android4.0以上源码中的DiskLruCache类简介
- Android 仿 窗帘效果 和 登录界面拖动效果 (Scroller类的应用) 附 2个DEMO及源码
- Android如何导入查看support包中的源码
- android源码中ccache使用及原理简介
- 《Android NFC 开发实战详解 》简介+源码+样章+勘误ING
- 导入android源码有错,R.java文件不能自动生成解决方法
- android4.4.2 Camera源码导入Eclipse