如何设置,而不是设置文字阴影的Andr​​oid按钮阴影 [英] How to set android button shadow instead of setting text shadow

查看:219
本文介绍了如何设置,而不是设置文字阴影的Andr​​oid按钮阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置一个阴影我的按钮,而是获得阴影整个按钮我得到它只是按钮的文本。

I'm trying to set a shadow for my button, but instead of getting shadow for the whole button I'm getting it for button's text only.

我都试过:使用XML风格

I've tried both: using xml styles

<style name="shadowed_button">
    <item name="android:shadowColor">#444444</item>
    <item name="android:shadowDx">1</item>
    <item name="android:shadowDy">1</item>
    <item name="android:shadowRadius">9</item>
</style>

和编程设置阴影

button.setShadowLayer(9, 1, 1, Color.rgb(44, 44, 44));

这两种工作方式相同。 有谁知道如何做到这一点?

Both work identically. Does anyone know how to do this?

推荐答案

要做到这一点,你必须做出的阴影和地点上的按钮,绘制按钮的图像。

To do so you have to make the image of the button with shadow and place on the button as drawable.

这篇关于如何设置,而不是设置文字阴影的Andr​​oid按钮阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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