SDK 5.0 RecyclerView不能被实例化 [英] SDK 5.0 RecyclerView could not be instantiated

查看:197
本文介绍了SDK 5.0 RecyclerView不能被实例化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我测试了新的API 21,我尝试创建一个RecyclerView,但我坚持了依赖问题。

I'm testing the new API 21, I try to create a RecyclerView but I'm stuck with a dependency problem.

该错误看起来像

我的布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin">
    <!-- A RecyclerView with some commonly used attributes -->
    <android.support.v7.widget.RecyclerView
        android:id="@+id/mRecyclerView"
        android:scrollbars="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</RelativeLayout>

和我的摇篮文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.agonist.samplify"
        minSdkVersion 17
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:cardview-v7:+'
    compile 'com.android.support:recyclerview-v7:+'
}

我不知道该怎么办。我试图清理/生成项目,但它留在这儿。你知道吗?

I don't know what to do. I tried to clean/build the project but it stay here. Any idea ?

编辑:Finnaly它只是一个IDE preVIEW问题。在执行过程中一切正常。

EDIT : Finnaly it's only an IDE preview problems. During execution everything works

推荐答案

新RecyclerView还没有工作的工作室。谷歌正在努力修复。 (公开发行72117

The new RecyclerView does not yet work in Studio. Google are working on a fix. (Open Issue 72117)

这篇关于SDK 5.0 RecyclerView不能被实例化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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