文本外观,在 TextView 和 CardView 中

Text appearance, inside TextView and CardView

当我使用 TextView 显示文本,并将示例的背景颜色设置为灰色时,显示的文本看起来被这种背景颜色吸收了。 所以我的想法是将 TextView 添加到 CardView,为 Cardview 提供背景颜色,并将 TextView 的高度设置为高于 CardView,但它仍然是相同的。我什至尝试在 CardView 中添加一个带有 Textview 的布局,并将布局的高度设置得更高。我希望显示的文本漂浮在视图上方。有人知道如何解决这个问题吗?

这是我的意思的截图。当您查看这些元素时,您会看到笑脸上方有一层薄薄的灰色(层压): https://drive.google.com/file/d/1W2E6Ivom0WEyrTtqBeLu1Z3rtHdMXKKS/view?usp=drivesdk

这是最后一个代码:

<androidx.cardview.widget.CardView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAlignment="viewEnd"
    android:layout_gravity="end"
    android:layout_margin="6dp"
    app:cardCornerRadius="5dp"
    android:elevation="20dp"
    android:background="#80817c">



<TextView 
    android:textSize="18sp"
    android:textAlignment="viewEnd"
    android:layout_gravity="end"
    android:id="@+id/user_ping"
    android:layout_margin="5dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:text="siema"
    android:elevation="25dp"/>
</androidx.cardview.widget.CardView>

好的,我找到了解决方案。你得给文字加上阴影效果,这样文字才会显得清晰,没有底色层压。