簡體   English   中英

如何在 android studio 中添加 Recycler 視圖

[英]How to add Recycler view in android studio

即使在build.gradle(Module:app)中添加依賴項后,我也無法使用RecyclerVeiw class

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
}

無需添加任何依賴

//in xml
<androidx.recyclerview.widget.RecyclerView>

// in class
import androidx.recyclerview.widget.RecyclerView;

無需添加任何特殊依賴只需更新 android studio 即可使用

即使您想通過添加依賴項使其正常工作,請添加此

//in xml add this
<androidx.recyclerview.widget.RecyclerView>

// in class add this
import androidx.recyclerview.widget.RecyclerView;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM