我是android初学者,目前正在探索RecycleView。在我在build.gradle中添加了recycleview依赖项之后,我试图将它添加到我的布局中,但我的背景并不像它应该的那样是白色的,而是一种黑色,在屏幕中央显示了一个文本,上面写着- androidx.recyclview.widget.RecycleView。这是与How to use androidx.recyclerview.widget.RecyclerView with tools:listitem?相同的问题,我遵循了那里的说明,但什么也没有发生。有人知道问题出在哪里吗?
我的build.gradle文件
import com.google.gms.googleservices.GoogleServicesPlugin
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.faks_app"
minSdkVersion 25
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-firestore:19.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
发布于 2019-05-14 06:55:15
android x <androidx.recyclerview.widget.RecyclerView
中RecyclerView的标签
确保这就是您在XML中使用的内容。有时,即使它在预览中显示深灰色+类名并不意味着它坏了,有时它就像文件->无效缓存并重新启动,清理项目并尝试运行应用程序一样简单。
https://stackoverflow.com/questions/56120725
复制相似问题