Java Androidx迁移后,MaterialCardView不会';不要受它的影响';s风格

Java Androidx迁移后,MaterialCardView不会';不要受它的影响';s风格,java,xml,android-studio,material-design,androidx,Java,Xml,Android Studio,Material Design,Androidx,我正在开发一款新的android应用程序,它使用谷歌材质设计组件显示咖啡饮料。在我将我的项目迁移到Androidx后,该样式将不会应用到MaterialCardView IDK中。问题是什么,为什么会发生这种情况 我尝试升级我的gradle文件,使用最新的材料库版本,通过网络搜索,没有发现任何类似的问题 <!--this is the card layout:--> <com.google.android.material.card.MaterialCardView

我正在开发一款新的android应用程序,它使用谷歌材质设计组件显示咖啡饮料。在我将我的项目迁移到Androidx后,该样式将不会应用到MaterialCardView IDK中。问题是什么,为什么会发生这种情况

我尝试升级我的gradle文件,使用最新的材料库版本,通过网络搜索,没有发现任何类似的问题

 <!--this is the card layout:-->

    <com.google.android.material.card.MaterialCardView  xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/coffee_card"
    style="@style/CoffeeItemStyle"
    android:layout_width="180dp"
    android:layout_height="200dp"
    android:layout_marginLeft="16dp"
    android:layout_marginTop="@dimen/cardview_margin"
    android:layout_marginRight="16dp"
    android:layout_marginBottom="@dimen/cardview_margin">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">


        <ImageView
            android:id="@+id/coffee_image"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:contentDescription="@string/coffee_drink_image"
            android:scaleType="centerCrop"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/coffee_name"
            style="@style/CoffeeNameStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="24dp"
            android:layout_marginTop="8dp"
            android:text="Name"
            app:layout_constraintBottom_toTopOf="@+id/coffee_image"
            app:layout_constraintStart_toStartOf="@+id/coffee_image"
            app:layout_constraintTop_toBottomOf="@+id/coffee_image"
            app:layout_constraintVertical_bias="0.82" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    </com.google.android.material.card.MaterialCardView>

<!--this is the style(CoffeeItemStyle):-->

     <style name="CoffeeItemStyle"     parent="Widget.MaterialComponents.CardView">
        <item name="cardBackgroundColor">@android:color/white</item>
        <item name="cardCornerRadius">@dimen/cardview_radius</item>
        <item name="cardElevation">@dimen/cardview_elevation</item>
        <item name="android:clickable">true</item>
        <item name="android:stateListAnimator">
            @animator/shr_next_button_state_list_anim
        </item>

    </style>