如何使用开源library?(Android)

来源:互联网 发布:linux 安装 pv 编辑:程序博客网 时间:2024/05/21 19:36

老板叫写Android代码,显示gif动态图片,搞了很长时间,看到一个开源代码,不会用,查了一下,在知乎上看到的,很棒!

引用一下;


不确定你已经到哪一步了,我就以PullToRefresh为例,从头开始说吧。

下载zip,解压到桌面
打开eclipse,File-Import-Existing Android Code Into Workspace
选中library文件,导入到eclipse中
打开此library,右键library,properties-Android-Library-勾选Is Library
打开你的程序后,右键你的主程序,properties-Android-Library-Add,选择library文件

导入的基本步骤就这样,接下来是如何使用
找到你的程序-layout-xml添加一个
<com.handmark.pulltorefresh.library.PullToRefreshListView
android:id="@+id/pull_to_refresh_listView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
回到MainActivity中,头文件中添加一段代码
import com.handmark.pulltorefresh.library.PullToRefreshListView;
之后把你需要用到的listview全部改为PullToRefreshListView,例如
private PullToRefreshListView mPullRefreshListView;
接着就像listview一样使用吧

大致就是这样,有什么问题再问吧,我尽量帮助。


ref: http://www.zhihu.com/question/23177262/answer/28889870

0 0
原创粉丝点击