Recyclerview预览显示灰屏,中间带有android.support.v7.widget.RecyclerView [英] Recyclerview preview showing grey screen with android.support.v7.widget.RecyclerView in center

查看:127
本文介绍了Recyclerview预览显示灰屏,中间带有android.support.v7.widget.RecyclerView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Recyclerview添加到我的活动布局,但是布局预览向我显示.我仔细研究了所有可能的答案,并尝试做

I am trying to add Recyclerview to my activity layout but the layout preview shows me this. I went through all possible answers which i could find out and tried doing things like

  1. 将应用程序主题更改为holo.light
  2. <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">添加到res>styles.xml
  3. 经历了所有可能的相关问题,例如这也并进行了更改相应地,在我的代码中.
  1. changing app theme to holo.light
  2. adding <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"> to res>styles.xml
  3. went through all possible relating questions like this and this as well and made changes accordingly in my code.

我的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和我的设备,m定位是oreo版本.

The same problem occurs when i am trying to use coordinate layout as well in my activity. I am using android studio 3.1.3 and my device that m targeting is of oreo version.

我无法找出问题所在.请帮我.

I am not able to figure out whats the problem. Kindly help me out.

推荐答案

尝试一下:

compileSdkVersion 27
buildToolsVersion '27.0.1'
targetSdkVersion 27

希望这会有所帮助.

这篇关于Recyclerview预览显示灰屏,中间带有android.support.v7.widget.RecyclerView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆