android - Android 海拔不适用于深色背景色
问题描述
<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>
或绘制。我需要使用轮廓和高度。
解决方案
您可以将视图包裹在 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>
推荐阅读
- php - SQL and PHP: Is it possible to convert a string to binary without using SQL function
- c++ - 从文本文件中获取 ASCII 瓦片图?
- javascript - 从字符串中查找变量类型
- c# - 在 Unity/Oculus 中设置立体渲染模式
- java - 如何在 Android 上自定义 Firebase Auth 域
- java - 由于缺少生成的类而导致的 Maven 编译错误
- tensorflow - Blazeface Openvino
- matlab - 绘图命令在 MatLab 代码中不起作用
- r - 在 R 中使用 data.table 进行有效分组
- node.js - 在 TypeORM 迁移中选择项目