Nic*_*zzi 4 android android-cardview androidx
我正在努力解决 CardView 角半径和背景颜色与 AndroidX 库的问题。
我的布局定义如下:
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
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"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/retail_card_width"
card_view:cardCornerRadius="@dimen/card_radius"
card_view:cardBackgroundColor="@color/baseYellow"
android:layout_height="@dimen/retail_card_height">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView android:layout_width="match_parent" android:layout_height="match_parent"
tools:src="@drawable/ic_fruit_1"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:scaleType="fitEnd"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="@+id/ivRetailBrand"
android:layout_width="@dimen/brand_icon_size"
android:layout_height="@dimen/brand_icon_size"
tools:src="@drawable/esselunga"
android:layout_marginTop="@dimen/retail_brand_margin"
android:background="@drawable/round_outline"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/retail_brand_margin"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
Run Code Online (Sandbox Code Playgroud)
不幸的是,我的布局似乎cardCornerRadius也没有cardBackgroundColor工作。我不明白我的问题是否依赖于 AndroidX 库。
这是我的布局预览:
| 归档时间: |
|
| 查看次数: |
11687 次 |
| 最近记录: |