执行动作条-PulltoRefresh由克里斯·巴内斯,libary错误等 [英] Implementing ActionBar-PulltoRefresh by Chris Banes, libary errors etc

查看:163
本文介绍了执行动作条-PulltoRefresh由克里斯·巴内斯,libary错误等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的$ P $有关从github上我的项目导入某些库pvious问题之后,我决定,我想实现一个不同的,但我得到很多错误,在这一点上。

Following up on my previous question about importing a certain library from github in my project, I decided I wanted to implement a different one, but I get lots of errors at this point.

<一个href="http://stackoverflow.com/questions/20500435/importing-android-listview-refresh-by-pull-project-properties-error">Importing Android的列表视图刷新由上拉,项目性质的错误

在与谷歌在线目前使用的克里斯·巴内斯'动作条,PullToRefresh: https://github.com/chrisbanes /动作条-PullToRefresh , 我已经决定,我想使用的库以及针对Android的应用程序,我目前正在为我的实习。当我尝试导入现有的code到从解压压缩文件的工​​作空间,虽然,我立即得到一吨的错误,在图书馆,以及在这个例子中的活动。例如,在库文件夹,在ActionBarPullToRefresh.java,它强调类的第一家民营散列表中,并表示引用泛型类应该是参数化。

In line with Google currently using Chris Banes' ActionBar-PullToRefresh: https://github.com/chrisbanes/ActionBar-PullToRefresh, I've decided I wanted to used that library as well for the Android app that I'm currently developing for my internship. When I try to import the existing code into the workspace from the unpacked zip-file though, I instantly get a ton of errors, in the library as well as in the example activities. For instance, in the library folder, in ActionBarPullToRefresh.java, it underlines Class within the first private hashmap and says references to the generic type Class should be parameterized.

在IDE(蚀)也给出吨的错误,以包括其他文件夹,当我添加库文件夹,我的主要项目库,使用属性 - > Android的标签,它承载过错误的项目(相当逻辑上)。

The IDE (eclipse) also gives tons of errors to the other folders included, and when I add the library folder to the libraries of my main project, using the properties -> android tab, it carries over the errors to that project (quite logically).

谁能送我到一个方向,以我应该如何成功地导入和使用这个库?

Could anyone send me into a direction as to how I should succesfully import and use this library?

感谢你在前进, 丹尼斯

Thank you in advance, Dennis

推荐答案

我会写这这里未来PullToRefresh用户。我使用的IntelliJ IDEA的而不是日食,所以请记住这个词的模块的和项目的是等效的。当您需要添加项目到Eclipse,动作的在跟帖添加模块的。

I will write this here for future PullToRefresh users. I use IntelliJ IDEA instead of eclipse, so remember that the word Module and Project are equivalent. When you have to add a project to Eclipse, the action is add module in IDEA.

例与 ActionBarSherlock (ABS从现在起)。

Example with ActionBarSherlock (ABS from now).

你有什么

  1. 您有一个的模块的命名为:MyProject的。这是你的主要的Andr​​oid模块。
  2. 您想PullToRefresh添加几个片段(例如)在MyProject的。
  1. You have a Module named: MyProject. This is your main Android module.
  2. You want to add PullToRefresh to a few Fragments (for example) in your MyProject.

第一步:下载并复制

我个人比较喜欢有我使用读取提交和修改日志库的克隆或叉。你不仅通过观看别人的code学习,但你也获得了最新消息你使用的库。这是一个双赢的局面。还记得杰夫·阿特伍德说:阅读资料来源,卢克。因此,为了做到这一点,克隆动作条,PullToRefresh从正确的网址

I personally like to have a clone or fork of the libraries I'm using to read the commits and change logs. Not only you learn by seeing other people's code, but also you get the "latest news" about the libraries you use. It's a win-win situation. Remember what Jeff Atwood said: "Read The Source, Luke". So in order to do this, Clone ActionBar-PullToRefresh from the right URL.

现在我不喜欢我的模块/项目的克隆所以我通常克隆项目的其他地方,后来手动移动我需要什么。这是乏味的,但这种方式我只得到我想要的。所以,你需要什么呢?克隆包含两个重要目录:其他的。我们将这些需要的东西。

Now I don't like having the clone with my modules/projects so I usually clone projects somewhere else and later manually move what I need. It's tedious but that way I only get what I want. So what do you need then? The clone contains two important directories: Extras and Library. We're going to need stuff from these.

复制库目录到你的项目根: /路径/要/你/项目/ pulltorefresh 相应的(ABS或COMPAT)额外的复制到项目的根,以及...

Copy the library directory to your project root: /path/to/your/project/pulltorefresh Copy the corresponding (ABS or Compat) extra to your project root as well…

这是你得到了什么至今:

This is what you got so far:

/path/to/your/project/MyProject
/path/to/your/project/pulltorefresh
/path/to/your/project/pulltorefresh-abs (or compat)

第二步导入这些: 导入这些模块(Eclipse项目)到项目/工作区。这应该是简单的,如果你知道你的IDE,但作为一个快速参考:文件 - >导入模块 - >找到从上面的pulltorefresh文件夹(和-abs或更高版本COMPAT),并按照向导。如果你使用的是Eclipse,<一个href="http://stackoverflow.com/questions/19163349/android-include-github-library-actionbar-pulltorefresh?rq=1">check这个链接就知道怎么做了。

Step Two Import these: Import these modules (projects in eclipse) into the project/workspace. This should be simple if you know your IDE, but as a quick reference: File -> Import Module -> find the pulltorefresh folder from above (and the -abs or compat later) and follow the wizard. If you're using Eclipse, check this link to know how to do it.

现在,你应该在你的左侧面板(⌘1)以下结构

Now you should have in your left panel (⌘1) the following structure

MyProject
pulltorefresh
pulltorefresh-abs

第3步添加正确的引用

假设 MyProject的 actiobnarsherlock.jar (因为你需要它)或者<$对应的android支持库C $ C> COMPAT 以及是否有相应的 Android的支持-V13 (或V4),以及...

Assuming MyProject has actiobnarsherlock.jar (because you need it) or the corresponding android support library for compat and that you have the corresponding android-support-v13 (or v4) as well…

  1. pulltorefresh 不需要任何库引用。
  2. pulltorefresh-ABS 需要引用: pulltorefresh Android的suppport-VX actiobbarsherlock
  3. MyProject的需要一个参考: pulltorefresh-ABS Android的询问服务-VX actiobbarsherlock
  1. pulltorefresh doesn't need any library reference.
  2. pulltorefresh-abs needs a reference to: pulltorefresh, android-suppport-vX and actiobbarsherlock
  3. MyProject needs a reference to: pulltorefresh-abs, android-suport-vX and actiobbarsherlock

当然,无论Android的支持和actiobarsherlock可以坐在MyProject的和导出(并从那里获取)的其他库,但是这是项目管理的101;)

Of course both android-support and actiobarsherlock could sit in MyProject and be exported (and taken from there) by the other libraries, but that's project management 101 ;)

第四步整合! 这种情况很容易,只要按照快速入门指南记住:在旧版本的lib的您有一个attacher一个活动,即不再是必要的。阅读文档,这是非常简单的(和更灵活的这种方式)。

Step 4 Integrate! This is easier, just follow the Quick Start Guide. REMEMBER: in older versions of the lib you had to have an attacher in an Activity, that is no longer necessary. Read the documentation, it's very simple (and much more flexible this way).

等等,如果你不使用任何福尔摩斯或COMPAT ??

我没有这样做呢,但我的猜测是:

I haven't done this yet, but my guess is:

  1. 不得进口-abs或-compat在演员。只需导入 pulltorefresh
  2. 从您的项目中,引用 pulltorefresh
  1. Don't import -abs or -compat in extras. Just import pulltorefresh.
  2. From your project, reference pulltorefresh.

等一下...怎么样进口?!

获取正确的进口为任何图书馆重要的,你必须要注意,而不是盲目地让你的IDE为你做(或者至少总是仔细检查您要导入什么的)。你会惊奇地看到有多少名称冲突就在外面。

Getting the right imports is important for any library, you have to pay attention and not blindly let your IDE do it for you (or at least always double check what you're importing). You'd be surprised to see how many "name collisions" are out there.

有关操作栏福尔摩斯基础的项目,进口应该是:

For Action Bar Sherlock based projects, the imports should be:

import uk.co.senab.actionbarpulltorefresh.extras.actionbarsherlock.PullToRefreshLayout;
import uk.co.senab.actionbarpulltorefresh.library.ActionBarPullToRefresh;
import uk.co.senab.actionbarpulltorefresh.library.listeners.OnRefreshListener;

对于非福尔摩斯纯项目:

import uk.co.senab.actionbarpulltorefresh.library.ActionBarPullToRefresh;
import uk.co.senab.actionbarpulltorefresh.library.listeners.OnRefreshListener;
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout;

你从哪里得到这些?!?!?!?!

通过查看样本中,卢克。

例如,<一个href="https://github.com/chrisbanes/ActionBar-PullToRefresh/blob/master/samples/stock/src/uk/co/senab/actionbarpulltorefresh/samples/stock/ListViewActivity.java"相对=nofollow>这里是为股票版本。

最后一步是将利润...但我离开这个给你;)

The final step would be to profit… but I leave that up to you ;)

如果你仍然有一个问题,人是友好的前提是你不要问偷懒的问题。随时跟踪项目,并参与<一href="https://github.com/chrisbanes/ActionBar-PullToRefresh/issues?direction=desc&sort=updated&state=open"相对=nofollow>问题页面在GitHub上。

If you still have an issue, the guys are friendly provided you don't ask lazy questions. Feel free to follow the project and participate in the issues page at github.

好运爽快!

这篇关于执行动作条-PulltoRefresh由克里斯·巴内斯,libary错误等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆