在 API 27 或以前的版本中更改高程阴影颜色

问题描述 投票:0回答:1

我需要更改视图的阴影颜色,尤其是MaterialCardView。无论如何,有办法在本地进行吗?或者也许是一个具有良好“绘图性能”的库? 我尝试了 View#setOutlineAmbientShadowColor(int color) 和 View#setOutlineSpotShadowColor(int color) 但不幸的是我无法在项目中使用 API 28 的东西。

android xml kotlin mobile material-design
1个回答
0
投票
  1. 在 styles.xml 中添加下面的代码
<resources>
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="android:fontFamily">@font/century_gothic</item>
    <item name="android:ambientShadowAlpha">1</item>
    <item name="android:spotShadowAlpha">1</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
© www.soinside.com 2019 - 2024. All rights reserved.