答案 0 :(得分:1)
尝试一下:
根据您的需要设置边距:
<?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="#CABBBBBB"/>
<corners android:radius="2dp" />
</shape>
</item>
<item
android:left="0dp"
android:right="0dp"
android:top="0dp"
android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="2dp" />
</shape>
</item>
</layer-list>
答案 1 :(得分:0)
您可以使用CardView进行文本布局和设置cardElevation。在Cardview教程中使用以下链接:
https://www.androidhive.info/2016/05/android-working-with-card-view-and-recycler-view/