android圆角button

1.在drawable下添加shape.xml

<?xml version="1.0" encoding="utf-8"?>
<shape 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <!-- 填充的颜色 -->
    <solid android:color="#AFBF13" />
    <!-- 设置按钮的四个角为弧形 -->
    <!-- android:radius 弧形的半径 -->
    <corners android:radius="5dip" /> 
    
    <padding 
        android:left="10dp"
        android:top="10dp"
        android:right="10dp"
        android:bottom="10dp"/>
    
</shape>

 2.在xml引用时加上

 android:background="@drawable/shape" 

 

posted @ 2014-10-16 17:14  smallBeans  阅读(200)  评论(0)    收藏  举报