如何导入 RecyclerView for Android L-preview [英] How to import RecyclerView for Android L-preview

查看:23
本文介绍了如何导入 RecyclerView for Android L-preview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用支持库中的新 RecyclerView.我使用 SDK 管理器下载了支持库的 20 更新.

Trying to use the new RecyclerView from the support library. I downloaded the 20 update for the support library using the SDK manager.

我已将 jar 文件添加到 libs 文件夹 - 并添加到构建路径 - 使用 RecyclerView 没有运气.

I've added the jar file to the libs folder - and added to build path - no luck using the RecyclerView.

尝试根据 Android 开发人员的 API 也使用 gradle 依赖项 - 不确定这是否是查看的正确位置 - 此页面与 AndroidTV 更多相关:

Tried to use also the gradle dependency according to Android Developer's API - not sure if this is the right place to look - this page is related more to AndroidTV :

 com.android.support:recyclerview-v7:20.0.+

无法对项目进行 gradle 同步.

Cannot gradle sync the project.

有什么想法吗?

推荐答案

想通了.

您必须添加以下 gradle 依赖项:

You'll have to add the following gradle dependency :

compile 'com.android.support:recyclerview-v7:+'

我在编译时遇到的另一个问题是 compileSdkVersion.显然你必须针对 android-L

another issue I had compiling was the compileSdkVersion. Apparently you'll have to compile it against android-L

您的 build.gradle 文件应如下所示:

Your build.gradle file should look something like this:

apply plugin: 'android'
android {
    compileSdkVersion 'android-L'
    buildToolsVersion '19.1.0'
    [...]
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:recyclerview-v7:+'
}

这篇关于如何导入 RecyclerView for Android L-preview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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