无法在当前主题 CardView 中找到样式“cardview 样式"在 Android Studio 3.1.3 中不起作用 [英] Failed to Find style 'cardview style ' in current theme CardView not working in Android Studio 3.1.3

查看:29
本文介绍了无法在当前主题 CardView 中找到样式“cardview 样式"在 Android Studio 3.1.3 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在当前主题中找不到样式cardview style"更新后 CardView 在 Android Studio 3.1.3 中不起作用

Android 工作室在尝试添加时显示渲染问题我的布局中的 CardView 小部件.

Android studio showing Render problem when ever am trying to add CardView widget in my layout.

    <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/linearLayout2"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.CardView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>



dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    implementation 'com.google.firebase:firebase-firestore:11.8.0'
    implementation 'com.android.support:cardview-v7:27.1.1'

    implementation 'com.android.support:support-v4:27.1.1'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    compile 'id.zelory:compressor:2.1.0'

    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:cardview-v7:27.1.1'
}

apply plugin: 'com.google.gms.google-services'

推荐答案

请在你的styles.xml中使用以下代码:

Please use bellow code into your styles.xml:

 <item name="cardViewStyle">@style/CardView</item>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="cardViewStyle">@style/CardView</item> //use this into your code 
</style>

让我知道这是否适合您.

let me know if this works for you.

这篇关于无法在当前主题 CardView 中找到样式“cardview 样式"在 Android Studio 3.1.3 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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