1、在res中的drawable文件夹中创建 ellipse_solid文件(命名随意),代码如下:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<shape android:shape="rectangle">
<solid android:color="#ffffffff" />
<corners android:radius="12dp" />
<item android:name="android:shadowColor">#66D1D1D1</item>
<item android:name="android:shadowDx">0</item>
<item android:name="android:shadowDy">0</item>
</shape>
</item>
</layer-list>
2、在LinearLayout布局中引用:
android:background="@drawable/ellipse_solid"
android:elevation="1dp"
android:translationZ="12dp"
3、效果如下: