由网友(命中不缺狗)分享简介:我用Google搜索它已经,但无法找到如何在Android的按钮,看起来像光泽闪亮的按钮有轻微的3D效果很好的提示。见PIC:I have googled it already but can't find a good hint on how to create buttons in android that lo...
我用Google搜索它已经,但无法找到如何在Android的按钮,看起来像光泽闪亮的按钮有轻微的3D效果很好的提示。见PIC:
I have googled it already but can't find a good hint on how to create buttons in android that look like glossy shiny buttons with a slight 3d effect. See pic:
我怎么能programmically做到这一点?任何提示?谢谢!
How can I programmically do this? Any hints? Thanks!
推荐答案
创建一个这样的选择,并将其应用到您的按钮绘制。它自定义您的要求:
Create a selector like this and apply it to your button drawable. Customize it to your requirements:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:endColor="#0905FB"
android:startColor="#9796FD"
android:angle="270" />
<stroke
android:width="3dp"
android:color="#65655B" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item android:state_focused="true" >
...
...
...
</item>
<item android:state_pressed="true" >
...
...
...
</item>
</selector>
相关推荐
最新文章