如何实现 Pre-Lollipop 的 Material-design Elevation [英] How to implement the Material-design Elevation for Pre-lollipop

查看:17
本文介绍了如何实现 Pre-Lollipop 的 Material-design Elevation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google 展示了在 Lollipop

感谢用户@Repo..

更新:如果你想改变这个drawable的颜色,试试@Irfan下面的回答↓

https://stackoverflow.com/a/40815944/3879847

Google has shown some nice ways that elevation effect are shown on Lollipop here.

android:elevation="2dp"

for buttons,

android:stateListAnimator="@anim/button_state_list_animator"

How can I mimic the elevation effect on pre-Lollipop versions without 3rd party library?

解决方案

You can mimic the elevation on pre-Lollipop with a official method.

I achieve same effect using,

  android:background="@android:drawable/dialog_holo_light_frame"

My tested output:

reference - https://stackoverflow.com/a/25683148/3879847

Thanks to user @Repo..

Update : If you want change color of this drawable try @Irfan answer below ↓

https://stackoverflow.com/a/40815944/3879847

这篇关于如何实现 Pre-Lollipop 的 Material-design Elevation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆