在我的项目(Eclipse)中使用 android.support.v7.widget.CardView [英] Using android.support.v7.widget.CardView in my project (Eclipse)

查看:26
本文介绍了在我的项目(Eclipse)中使用 android.support.v7.widget.CardView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用新的 Android L 开发者预览版支持库中引入的新 CardView 小部件(如前所述 此处),这似乎是 v7 支持库新修订版的一部分.

I'd like to use the new CardView widget that was introduced with the new Android L Developer Preview Support Library (As mentioned here), which seems to be part of a new revision of the v7 support library.

我现在已经更新了我的 SDK 版本,下载了最新的支持库包,但我仍然找不到新的 CardView 小部件.

I have now updated my SDK version, downloaded the newest Support Library package, but I still cannot find the new CardView widget.

我已经搜索了网络和官方文档,但无法获得有关从何处获取新支持库的任何提示.

I already searched the web and the official docs, but could not get any hints on where I can get the new support library.

非常感谢任何帮助!

我正在使用 ADT/Eclipse

I'm using ADT/Eclipse

推荐答案

我终于找到了在 ADT/Eclipse 中使用 CardView 的方法.其实很简单:

I finally found a way to use CardView in ADT/Eclipse. It's actually pretty easy:

  1. 在 Android Studio 中创建一个新项目
  2. 按照此问题的其他答案中的说明添加 CardView 依赖项
  3. 打开ADT并创建一个包名为android.support.v7.cardview
  4. 的新库项目
  5. 删除所有 ADT 自动创建的资源
  6. 在 Android Studio 中找到 exploded-aar 文件夹并将以下文件复制到这些位置:
    • res/values/values.xml 到 ADT 项目中的相同位置
    • classes.jar 到 ADT 项目中的 libs/
    • AndroidManifest.xml 用它来替换 ADT 中自动生成的清单
  1. Create a new project in Android Studio
  2. Add the CardView dependency as explained in the other answers to this question
  3. Open ADT and create a new library project with package name android.support.v7.cardview
  4. Delete all resources ADT auto-created
  5. Find the exploded-aar folder in Android Studio and copy the following files to these locations:
    • res/values/values.xml to the same location in your ADT project
    • classes.jar to libs/ in your ADT project
    • AndroidManifest.xml use it to replace the auto-generated manifest in ADT

除了必须创建一个新的 Android Studio 项目来获取 AAR 的内容之外,您还可以简单地从本地 maven 存储库中找到并解压缩 AAR.只需按照以下 Andrew Chen 提供的步骤操作即可.

As an alternative to having to create a new Android Studio project in order to get the AAR's content, you could also simply find and unzip the AAR from the local maven repo. Just follow the steps provided by Andrew Chen below.

请注意,CardView 库可能无法以源代码和 ADT 兼容形式提供,因为它仍然只是预览和 WIP.由于在后续版本中可能会有错误修复和改进,因此务必使库保持最新状态,这很容易使用 Gradle 依赖项,但在使用上述步骤时必须手动完成.

Please note the CardView library might not be available in source- and ADT-compatible-form because it's still only a preview and a WIP. As there might be bug fixes and improvements in following releases, it's important to keep the library up-to-date, which is easy using the Gradle dependency, but must be done manually when using the steps provided above.

这篇关于在我的项目(Eclipse)中使用 android.support.v7.widget.CardView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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