简体   繁体   English

为什么我不能导入LinearLayoutManager和RecyclerView?

[英]Why can't I import LinearLayoutManager and RecyclerView?

I can import everything else from the Android library except for those two. 除了这两个,我可以从Android库导入其他所有内容。 I'm trying to import them from android.support.v7.widget which doesn't work, but importing fragment and activity classes from android.support.v4.widget does work. 我试图从android.support.v7.widget导入它们不起作用,但从android.support.v4.widget导入片段和活动类确实有效。

My Gradle Build looks like this: 我的Gradle Build看起来像这样:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.frisosapps.planner"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:support-v4:22.2.1'
}

Should I add something to this or should I look for the cause elsewhere? 我应该为此添加一些东西还是应该在其他地方寻找原因?

要使用RecyclerView ,请使用compile 'com.android.support:recyclerview-v7:23.1.1'

您需要将RecyclerView依赖项作为其独立库包含在内

compile "com.android.support:recyclerview-v7:23.1.1"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有LinearLayoutManager的RecyclerView,带有不回收的标题视图 - RecyclerView with LinearLayoutManager with header view that doesn't recycle 为什么使用KOTLIN在LinearLayoutManager RecyclerView中选择Orientation会出现这个错误 - Why does this error occur when choosing Orientation in LinearLayoutManager RecyclerView with KOTLIN 未解决的参考:LinearLayoutManager/RecyclerView - Unresolved reference: LinearLayoutManager/RecyclerView 使用LinearLayoutManager集中化RecyclerView - Centralizing RecyclerView with LinearLayoutManager 使用 LinearLayoutManager 在 RecyclerView 中滚动到顶部 - Scroll to top in RecyclerView with LinearLayoutManager 我应该使用RecyclerView.VERTICAL而不是LinearLayoutManager.VERTICAL吗? - Should I use RecyclerView.VERTICAL instead of LinearLayoutManager.VERTICAL? 如何在Robolectric中对RecyclerView,LinearLayoutManager进行单元测试? - How do I unit test RecyclerView , LinearLayoutManager in Robolectric? 带有GridLayoutManager的RecyclerView和带有LinearLayoutManager的RecyclerView - RecyclerView with GridLayoutManager inside RecyclerView with LinearLayoutManager 错误 package androidx.recyclerview.widget 不存在 import androidx.recyclerview.widget.LinearLayoutManager; - Error package androidx.recyclerview.widget does not exist import androidx.recyclerview.widget.LinearLayoutManager; xamarin RecyclerView LinearLayoutManager StackFromEnd丢失 - xamarin RecyclerView LinearLayoutManager StackFromEnd missing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM