如何在toolbar添加阴影

如何在toolbar添加阴影,第1张

在版本小于5.0之前的设备是没有Material Design的特效的,所以也没有阴影;所以这时候就要通过自定义文件来实现。

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"

android:shape="rectangle">

<gradient

android:startColor="@android:color/transparent"

android:endColor="#88333333"

android:angle="90"/>

123456789

由文件可以看出,这是一个颜色渐变的过程,然后通过帧布局可以覆盖的特性来实现覆盖在底层布局上的阴影。

For Android 5.0, if you want to set it directly into a style use: 0dp and for Support library compatibility use: 0dp Example of style for a AppCompat light theme: 0dp Then apply this custom ActionBar style to you app theme: @st。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/bake/11265426.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-14
下一篇 2023-05-14

发表评论

登录后才能评论

评论列表(0条)

保存