1. 程式人生 > >android 給view添加陰影

android 給view添加陰影

布局 corn xmlns ati auto out schema port support

1、方法一:

使用 CardView 布局

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:cardBackgroundColor="#ffffff"
app:cardCornerRadius="4dp"
app:cardElevation="3dp">

2、方法二:
使用屬性 android:elevation="3dp"

android 給view添加陰影