开发者

Programmatically create glossy 3d button

开发者 https://www.devze.com 2023-03-19 20:53 出处:网络
I have googled it 开发者_如何学Calready 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:

I have googled it 开发者_如何学Calready 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:

Programmatically create glossy 3d button

How can I programmatically do this?


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消