Android的AppCompat 21高程 [英] Android AppCompat 21 Elevation

查看:208
本文介绍了Android的AppCompat 21高程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法来增加高度,以pre-棒棒糖设备上查看无包装他们在一个 CardView

Is there any way to add elevation to a View in pre-lollipop devices without wrapping them in a CardView?

推荐答案

ViewCompat.setElevation(查看,INT)当前创建无垫片。

模拟海拔,现在唯一的办法是采用影子pre-V21。定义你的风格/布局/绘制在并覆盖它值-V21 。对于按钮,我使用的样式覆盖。对于布局,我通常会去参考倍率(使用 @null 来摆脱的绘制)。

The only way to simulate elevation right now is to apply a shadow pre-v21. Define your style/layout/drawable in values and override it in values-v21. For buttons I use style overrides. For layouts, I usually go for reference override (use @null to get rid of a drawable).

希望在未来的更新支持库将增加垫片。

Hopefully in the future an update to the support library will add shims.

<一个href="http://www.reddit.com/r/androiddev/comments/2kd843/so_how_are_you_guys_doing_with_your_current/">This reddit的线程跟踪所述更新的。

新的支持设计库实际上做创建垫片为流动动作按钮。

The new support design library actually does create shims for the floating action button.

这篇关于Android的AppCompat 21高程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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