<LinearLayout
android:id="@+id/headerContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/dark_green"
android:elevation="32dp"
android:outlineProvider="background"/>我试图用上面的代码添加一个下拉阴影,但是如果背景颜色是暗的,我看不到阴影。但是如果颜色是白色的,那就没问题了。
请不要建议使用<layer-list>或drawable。我需要使用outline和elevation。
发布于 2019-12-19 01:32:35
您可以将视图包装在cardview中以获得阴影效果。
如果要更改卡片的背景颜色,请使用:
app:cardBackgroundColor="@somecolor"如下所示:
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/white">
</android.support.v7.widget.CardView>https://stackoverflow.com/questions/59394327
复制相似问题