码迷,mamicode.com
首页 > 其他好文 > 详细

用xml创建带圆角和阴影的按钮背景

时间:2014-08-17 18:29:32      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   color   io   文件   ar   

效果如图
bubuko.com,布布扣

按钮布局文件

<Button

    android:layout_width="match_parent"

    android:layout_height="80dip"

    android:background="@drawable/hi"

    android:text="@string/click_button"

    android:textColor="#999"

    android:textSize="18dip"

    android:textStyle="bold" />

背景drawable文件

<?xml version="1.0" encoding="utf-8"?>

    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <!-- Bottom 2dp Shadow -->

    <item android:bottom="11px" android:top="19px" android:left="10px" android:right="10px">

        <shape android:shape="rectangle" >

            <solid android:color="#ccc" />

            <corners android:radius="7dp" />

        </shape>

    </item>

    <!-- White Top color -->

    <item android:bottom="15px" android:top="15px" android:left="10px" android:right="10px">

        <shape android:shape="rectangle" >

            <solid android:color="#FFFFFF" />

            <corners android:radius="7dp" />

        </shape>

    </item>

</layer-list>

用xml创建带圆角和阴影的按钮背景,布布扣,bubuko.com

用xml创建带圆角和阴影的按钮背景

标签:android   style   blog   http   color   io   文件   ar   

原文地址:http://www.cnblogs.com/dongye/p/3918043.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!