Android Studio(3.1.4)设计+蓝图的渲染问题

时间:2018-08-25 12:02:31

标签: android android-layout android-studio

这是默认的入门项目。尚未编写新代码。 图片说明了一切:

orignal

Android SDK Manager: enter image description here

build.gradle(Module:app)

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "chatchattan.nooguiquirks.com.chatchattan"
        minSdkVersion 15
        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(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    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:recyclerview-v7:28.0.0-rc01'
}

我想我已经为此下载了必要的SDK(28)。甚至尝试降级到API 24,25来查看它是否更改,但是“设计和蓝图”渲染预览不起作用。

尝试的解决方案:

  1. 确保您的Android SDK已更新为build.gradle

  2. 清洁项目

  3. 使缓存/重新启动无效

  4. 使用应用主题

仍然没有!

有什么好主意吗? :)

6 个答案:

答案 0 :(得分:11)

只需按照以下步骤操作即可,

1在App Theme Top上打开设计布局窗口

enter image description here

2将主题更改为浅色

enter image description here

答案 1 :(得分:2)

在styles.xml中添加基础

<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

答案 2 :(得分:0)

    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    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:recyclerview-v7:28.1.1'
}

答案 3 :(得分:0)

“设计”视图无法呈现布局的原因有多种。

您可以尝试以下

*Make sure XML representation of layout is error free.
Try changing the API levels in the design views.
Clean build your project by going to Build > Clean build
Ensure you don’t have any file from SDK that is missing
If everything is proper still if android studio is not able to render your layout invalidate cache and restart android studio by going to File > Invalidate Cache/Restart*

答案 4 :(得分:0)

最新的支持库版本中存在一些错误

因此解决方案将android支持库版本更改为28.0.0-alpha1

或返回使用27个SDK版本

答案 5 :(得分:0)

您必须在module:app中更改

fac[j] = (fac[j - 1] * (j % 1000000007)) % 1000000007

与此:

fac

然后同步