android - 我只想在卡片视图的底部添加阴影,我尝试了很多解决方案,但没有人给我我想要的
问题描述
我只想在卡片视图的底部添加一个阴影,我尝试了很多解决方案,但没有人给我我想要的。
app:cardElevation=""
在cardview(顶部、右侧、左侧和底部)周围添加阴影,我也尝试过这样做,android:outlineAmbientShadowColor="@android:color/transparent"
但它不起作用。我需要一个解决方案。
<RelativeLayout
android:id="@+id/list_item_root_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/selected_item_tic_iv"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_selected_item_tek"
android:layout_alignParentRight="true"
android:layout_marginEnd="@dimen/tiny_margin"
android:layout_marginRight="@dimen/tiny_margin"
android:layout_marginTop="@dimen/tiny_margin"
android:elevation="@dimen/small_elevation"
android:visibility="gone"/>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/below_large_margin"
android:layout_marginStart="@dimen/below_large_margin"
android:layout_marginLeft="@dimen/below_large_margin"
android:layout_marginEnd="@dimen/below_large_margin"
android:layout_marginRight="@dimen/below_large_margin"
android:layout_marginBottom="@dimen/below_large_margin"
app:cardCornerRadius="@dimen/above_med_corner_radius">
<LinearLayout
android:id="@+id/list_item_container_ll"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/card_border">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/below_large_margin">
<RelativeLayout
android:id="@+id/suitcase_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/below_large_margin"
android:layout_marginStart="@dimen/below_large_margin"
android:layout_marginLeft="@dimen/below_large_margin">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/suitcase"
android:layout_centerInParent="true"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center">
<LinearLayout
android:id="@+id/old_offer_layout"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/small_no_margin"
android:background="@drawable/diagonal_line">
<TextView
android:id="@+id/old_offer_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:shadowColor="#80000000"
android:shadowDy="2"
android:shadowRadius="4"
android:fontFamily="@font/tajwal"
android:textStyle="normal"
android:textSize="@dimen/large_text_size"
android:textColor="@color/offer_text_grey_color"
android:lineSpacingExtra="@dimen/med_LSE"
android:text="60"
android:layout_marginEnd="1dp"
android:layout_marginRight="1dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:shadowColor="#80000000"
android:shadowDy="2"
android:shadowRadius="4"
android:fontFamily="@font/tajwal"
android:textStyle="normal"
android:textSize="@dimen/below_med_text_size"
android:textColor="@color/offer_text_grey_color"
android:lineSpacingExtra="@dimen/med_LSE"
android:text="GB"/>
</LinearLayout>
<TextView
android:id="@+id/new_offer_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:shadowColor="#80000000"
android:shadowDy="2"
android:shadowRadius="4"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/huge_text_size"
android:textColor="@color/white"
android:lineSpacingExtra="@dimen/huge_no_LSE"
android:text="120"
android:gravity="center"
android:layout_marginBottom="@dimen/med_no_margin"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:shadowColor="#80000000"
android:shadowDy="2"
android:shadowRadius="4"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/above_large_text_size"
android:textColor="@color/white"
android:lineSpacingExtra="@dimen/huge_no_LSE"
android:text="GB"
android:gravity="center" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/validity_layout"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/suitcase_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/above_med_margin"
android:layout_marginStart="@dimen/below_large_margin"
android:layout_marginLeft="@dimen/below_large_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/above_small_text_size"
android:textColor="@color/black_text_color"
android:lineSpacingExtra="@dimen/small_LSE"
android:text="Valid for "/>
<TextView
android:id="@+id/validity_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/above_small_text_size"
android:textColor="@color/black_text_color"
android:lineSpacingExtra="@dimen/small_LSE"
android:text="15 days"/>
</LinearLayout>
<LinearLayout
android:id="@+id/price_currency_layout"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/med_margin"
android:layout_marginEnd="@dimen/below_large_margin"
android:layout_marginRight="@dimen/below_large_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/above_small_text_size"
android:textColor="@color/black_text_color"
android:text="AED "/>
<TextView
android:id="@+id/price_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/above_large2_text_size"
android:textColor="@color/black_text_color"
android:text="300"/>
</LinearLayout>
<View
android:id="@+id/horizontal_line"
app:layout_constraintStart_toEndOf="@id/suitcase_layout"
app:layout_constraintTop_toBottomOf="@id/price_currency_layout"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="0dp"
android:layout_height="1dp"
android:background="@color/grey_border_color"
android:layout_marginStart="@dimen/below_large_margin"
android:layout_marginLeft="@dimen/below_large_margin"
android:layout_marginEnd="@dimen/large_margin"
android:layout_marginRight="@dimen/large_margin" />
<TextView
android:id="@+id/data_tv"
app:layout_constraintStart_toEndOf="@id/suitcase_layout"
app:layout_constraintTop_toBottomOf="@id/horizontal_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/below_large_margin"
android:layout_marginStart="@dimen/below_large_margin"
android:layout_marginTop="@dimen/small_margin"
android:fontFamily="@font/tajwal"
android:textStyle="normal"
android:textSize="@dimen/below_med_text_size"
android:textColor="@color/black_text_color"
android:text="Data"/>
<TextView
android:id="@+id/local_min_tv"
app:layout_constraintStart_toEndOf="@id/suitcase_layout"
app:layout_constraintTop_toBottomOf="@id/data_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/below_large_margin"
android:layout_marginStart="@dimen/below_large_margin"
android:layout_marginTop="@dimen/tiny_margin"
android:fontFamily="@font/tajwal"
android:textStyle="normal"
android:textSize="@dimen/below_med_text_size"
android:textColor="@color/black_text_color"
android:text="Local"/>
<TextView
android:id="@+id/intl_tv"
app:layout_constraintStart_toEndOf="@id/suitcase_layout"
app:layout_constraintTop_toBottomOf="@id/local_min_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/below_large_margin"
android:layout_marginStart="@dimen/below_large_margin"
android:layout_marginTop="@dimen/tiny_margin"
android:fontFamily="@font/tajwal"
android:textStyle="normal"
android:textSize="@dimen/below_med_text_size"
android:textColor="@color/black_text_color"
android:text="Intl."/>
<LinearLayout
android:id="@+id/data_layout"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/horizontal_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/small_margin"
android:layout_marginEnd="@dimen/below_large_margin"
android:layout_marginRight="@dimen/below_large_margin">
<TextView
android:id="@+id/data_amount_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/below_med_text_size"
android:textColor="@color/pink_text_color"
android:text="8 "/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/below_med_text_size"
android:textColor="@color/pink_text_color"
android:text="GB per day"/>
</LinearLayout>
<LinearLayout
android:id="@+id/local_min_layout"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/data_layout"
android:layout_marginTop="@dimen/tiny_margin"
android:layout_marginEnd="@dimen/below_large_margin"
android:layout_marginRight="@dimen/below_large_margin">
<TextView
android:id="@+id/local_min_amount_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/below_med_text_size"
android:textColor="@color/pink_text_color"
android:text="30 "/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/below_med_text_size"
android:textColor="@color/pink_text_color"
android:text="min / SMS"/>
</LinearLayout>
<LinearLayout
android:id="@+id/intl_layout"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/local_min_layout"
android:layout_marginTop="@dimen/tiny_margin"
android:layout_marginEnd="@dimen/below_large_margin"
android:layout_marginRight="@dimen/below_large_margin">
<TextView
android:id="@+id/intl_min_amount_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/below_med_text_size"
android:textColor="@color/pink_text_color"
android:text="20 "/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/below_med_text_size"
android:textColor="@color/pink_text_color"
android:text="min / SMS"/>
</LinearLayout>
<LinearLayout
android:id="@+id/check_list_layout"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/intl_tv"
app:layout_constraintStart_toEndOf="@id/suitcase_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/above_large_margin"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="normal"
android:textSize="@dimen/small_text_size"
android:lineSpacingExtra="@dimen/small_LSE"
android:textColor="@color/black_text_color"
android:text="Check list of "/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/small_text_size"
android:lineSpacingExtra="@dimen/small_LSE"
android:textColor="@color/red_text_color"
android:text="supported countries"/>
</LinearLayout>
<LinearLayout
android:id="@+id/free_botim_layout"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/check_list_layout"
android:layout_marginTop="@dimen/med_margin"
android:layout_marginStart="@dimen/below_large_margin"
android:layout_marginLeft="@dimen/below_large_margin"
android:layout_marginEnd="@dimen/below_large_margin"
app:layout_goneMarginLeft="@dimen/below_large_margin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="start"
android:background="@drawable/botim_layout_background"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/botim"
android:layout_margin="@dimen/tiny_margin"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/small_text_size"
android:textColor="@color/black_text_color"
android:text="Including Free BOTIM subscription. "
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/tajwal"
android:textStyle="bold"
android:textSize="@dimen/small_text_size"
android:textColor="@color/red_text_color"
android:text="More info"
android:layout_gravity="center"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
解决方案
推荐阅读
- python - 有没有办法在绘图中改变旭日形图中层的厚度
- python - 迭代地理数据框时更改几何图形
- react-native - 无法使用 Expo Vector Icons 中的所有图标
- .net - ECDiffieHellman 继承自 AsymmetricAlgorithm 但没有实现 ICspAsymmetricAlgorithm?
- javascript - 错误:在猫鼬中检测到循环依赖
- php - Yii2 从 Web 控制器调用控制台控制器,其行为类似于 Web 控制器
- java - Visual Studio 代码错误 - 字符串无法解析为类型
- javascript - 引导边距导致无变化
- linux - 如何按列重新排列文本文件的块
- c# - 将字符串反序列化为包含对象的字典