您的位置:首页 > 其它

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

2014-08-17 17:55 162 查看
效果如图




按钮布局文件

<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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: