因为项目中用到第三级菜单,我们原有的界面框架已经不适用于该项目,Android L出了新的cardview设计,爬了下github发现有些高手已经把card整合为更方便调用的类库了,我这个项目就准备试用一下其中的一个开源项目cardslib      , 而github我也是初次使用,正好在项目中来熟悉使用方法

首先:

  cardslib项目地址:https://github.com/gabrielemariotti/cardslib,意大利的一位java/android工程师gabrielemariotti,基于Android L 的cardview做的一个便于引用和扩展的卡片式布局,可以fork一下到自己的代码仓库。

  我的项目中主要用到其中的library-corelibrary-cards,以下为作者提供的eclipse中引入该项目为类库的方法(不得不说国外开发牛实在是太贴心了T_T,文档写得尽善尽美,我这种初级菜鸟也能按部就班的实现):

Reference this project as a library in Eclipse

If you would like to use this library-core in Eclipse you have to do these steps:

  • clone a copy of this repository, or download it (outside eclipse workspace)
  • import the code in your workspace starting from library folder. The Wizard will import the code in library-core/src/main. I suggest you naming it "cardscore" (or another name) instead of "main".
  • mark java(*) folder as source (click on folder -> Build-Path -> use as source folder). You can also remove the src folder, from the project.
  • mark cardscore as Android Library (Properties -> Android -> Is library)
  • add support library v4 rel.21
  • add support cardview library v7 rel.21
  • add support annotation library rel.21
  • The library targets SDK 21 and works with minSdk=14. In any cases you need to use API>=21 to compile library (Properties -> Android)
  • Clean and build

If you would like to use this library-cards in Eclipse you have to do these steps:

  • clone a copy of this repository, or download it (outside eclipse workspace)
  • import the code in your workspace starting from library folder. The Wizard will import the code in library-cards/src/main. I suggest you naming it "cardscore" (or another name) instead of "main".
  • mark java(*) folder as source (click on folder -> Build-Path -> use as source folder). You can also remove the src folder, from the project.
  • mark cardscore as Android Library (Properties -> Android -> Is library)
  • add the cardscore as library
  • The library targets SDK 21 and works with minSdk=14. In any cases you need to use API>=21 to compile library (Properties -> Android)
  • Clean and build

注意要点:

1、需要anroid 21的SDK支持

2、把引用代码的main文件夹重命名,并右键build-path该文件夹为"use as source folder",否则可能会造成代码冲突

3、将工程作为Android Libaray,引入相应support  library

引用后,在build时和编译时分别出过一个问题:

1、build后,报错,Found 4 versions of android-support-v4.jar in the dependency list

查看了报错信息是因为之前引用的滑动菜单的几个library中,android-support-v4的版本和cardslib中所用版本不同。拷cardslib中的v4过去就行了

2、运行时报错,2 Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;

应该是导入的包和以前的导入有冲突,解决办法简单粗暴:我把我的项目中libs文件夹下的包全部拷出来,然后重建这个文件夹,手动一个个拷进去检查,直到0 error为止(可能有些运行时要用的包没有拷到,以后运行时报错的时候再根据提示单独拷就可以了:)最后在stackoverflow找到原因,引用的library-core库中,新版本的support-v4包已经包含了support-annotations的内容,删去annotations包即可:

The problem is that android-support-annotations.jar used to be a separate library containing the android annotations, but for some reason these annotations are already included in recent versions of the android-support-v4.jar file.

转载于:https://www.cnblogs.com/melonrice/p/4103997.html

Android项目笔记【项目管理统计图app】:使用github上的cardslib开源项目实现CardView(1)...相关推荐

  1. GitHub上优秀的开源项目(转载)

    GitHub上优秀的开源项目(转载) 转载出处:https://github.com/Trinea/android-open-project 第一部分 个性化控件(View) 主要介绍那些不错个性化的 ...

  2. 2020年10月份Github上热门的开源项目

    10月份GitHub上最热门的Java开源项目排行已经出炉啦,一起来看看上榜详情吧: 1. base-admin https://github.com/huanzi-qch/base-admin St ...

  3. 如何在 GitHub 上高效搜索开源项目(转载)

    如何在 GitHub 上高效搜索开源项目 查看全文 http://www.taodudu.cc/news/show-1347360.html 相关文章: Mybatis.cfg配置标签的顺序问题 To ...

  4. 云炬Android开发笔记 2-3Android Studio如何导入Github上的项目

    工具/原料 本机已安装了git 方法/步骤 1 首先ctrl+alt+s(前往settings),选择Version Control下的git选择Git,然后看自己Path to Git execut ...

  5. 如何在 GitHub 上高效搜索开源项目

    GitHub 的流行及其在开源世界的受欢迎程度自不必多言.再加上近来GitHub 官方又搞了个大新闻:私有仓库也改为免费使用,这在原来可是需要真金白银买的.可见微软收购后,依然没有改变 GitHub ...

  6. 你真的知道如何在 GitHub 上高效搜索开源项目吗?

    作者 | 侯树成 本文经授权转自Tomcat那些事儿 GitHub 的流行及其在开源世界的受欢迎程度自不必多言.再加上近来GitHub 官方又搞了个大新闻:私有仓库也改为免费使用,这在原来可是需要真金 ...

  7. 使用github上已有的开源项目

    如何使用外部的项目 首先下载好github上的项目源码:https://github.com/wzhe06/ipdatabase.git 编译下载好的项目:mvn clean package -Dsk ...

  8. 回顾 | 在 GitHub 上贡献到开源项目

    点击蓝字 关注我们 精彩回顾 GitHub 是世界上最大的开源社区,拥有数百万个开源项目.GitHub 的优势之一是在项目上进行协作非常容易.在本研讨会中,我们将介绍在 GitHub 上找到开源项目并 ...

  9. .Net资讯 | 一大波开发者福利来了, 一份微软官方Github上发布的开源项目清单等你签收...

    目录 微软Github开源项目入口 微软开源项目受欢迎程度排名 Visual Studio Code TypeScript RxJS .NET Core 基础类库 CNTK Microsoft cal ...

最新文章

  1. AI入门:不用任何公式把Embedding讲清楚
  2. 地理模块化施工的优点_模块化建筑适合学校的6个原因
  3. bulter机器人_科普!九款使用率最高的物流机器人大盘点!
  4. 信息学奥赛一本通(2067:【例2.5】圆)
  5. 学习索引结构的一些案例——Jeff Dean在SystemML会议上发布的论文(下)
  6. sql中带in条件的查询及提高效率
  7. byte[] 转成 bitmap
  8. iOS开发之App上架流程(2017)
  9. 软件是计算机程序的总和 主要分为,2014年造价师考试安装工程专业讲义:计算机控制...
  10. 靶机渗透练习21-Noob
  11. html中span标签的详细介绍
  12. 使用node实现向手机发送验证码
  13. 关于虚拟机复制文件时:无法确定本地文件类型。您可能没有执行此操作的权限。 正在取消文件复制操作。的决解方法
  14. Java:String类学习笔记
  15. 劳务派遣能解决哪些用工难题?企业关心的都在这里!
  16. 史上最严数据保护条例欧盟GDPR今日生效,你可能需要这版中文全文(下)
  17. 【关于ChatGPT的30个问题】26、ChatGPT的开发团队是谁?/ By 禅与计算机程序设计艺术
  18. 五款开源图像处理软件
  19. OTA本质与实现流程分析
  20. 网站策划文案-论坛系统模块简介

热门文章

  1. vs不一致的行尾对话框怎么调出_SolidWorks工程图打开后图纸没有了空白了怎么办?还能找回来吗?...
  2. yolov4论文_Alexey 大神接棒,YOLOv4 重磅来袭!快来一睹论文真容吧!| 原力计划...
  3. python和rpa_什么是RPA
  4. .vue文件_Spring Boot 2.x(十六):玩转vue文件上传
  5. support v4官方下载_掌心长兴客户端下载-掌心长兴ap下载v4.1.4 安卓官方版
  6. 千兆网综合布线系统的线缆选型
  7. 光端机的几种物理接口类型
  8. [渝粤教育] 广东-国家-开放大学 21秋期末考试财政学10573k1
  9. 【渝粤教育】21秋期末考试工程经济10202k2
  10. 【渝粤教育】广东开放大学 劳动关系理论与实务 形成性考核 (1)