How to add the recyclerview to project

后端 未结 5 1263
栀梦
栀梦 2021-02-19 03:21

tried to import android.support.v7.widget.RecyclerView, but it didn\'t work, added also

compile \'com.android.support:recyclerview-v7:23.1.1\'

5条回答
  •  情话喂你
    2021-02-19 03:55

    1. Open build.gradle and add recycler view dependency. com.android.support:recyclerview-v7:23.1.1 and rebuild the project.

    build.gradle

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'}
    
    1. With the latest version of build tools, Android Studio is creating two layout files for each activity. For main activity, it created activity_main.xml (contains CoordinatorLayout and AppBarLayout) and content_main.xml (for the actual content). Open content_main.xml and the recycler view widget.

    Layout

    
    
    
    

提交回复
热议问题