【发布时间】:2018-08-07 09:59:26
【问题描述】:
我正在尝试将 Recyclerview 添加到我的活动布局中,但布局预览显示 this。我浏览了所有可能的答案,我可以找到并尝试做类似的事情
- 将应用主题更改为 holo.light
- 将
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">添加到res>styles.xml - 检查了所有可能的相关问题,例如 this 和 this as well,并在我的代码中进行了相应的更改。
我的build.gradle文件如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.1'
defaultConfig {
applicationId "com.myapp.test"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:28.0.0-alpha3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0-alpha3'
implementation 'com.android.support:cardview-v7:28.0.0-alpha3'
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha3'
}
当我尝试在我的活动中使用坐标布局时,也会出现同样的问题。我正在使用 android studio 3.1.3,而我的目标设备是 oreo 版本。
我无法弄清楚问题所在。请帮帮我。
【问题讨论】:
-
将您的项目降级到 SDK 27 并检查
标签: android android-studio android-recyclerview android-coordinatorlayout