圆角布局或者圆角按钮

来源:互联网 发布:linux 新建文件夹 编辑:程序博客网 时间:2024/04/29 00:28

添加shape.xml

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

<shape xmlns:android="http://schemas.android.com/apk/res/android">



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


    <corners android:topLeftRadius="3dp"   


     android:topRightRadius="0dp"


     android:bottomRightRadius="0dp"      


     android:bottomLeftRadius="3dp"/>  


<padding android:left="0dp"android:top="0dp" android:right="0dp"android:bottom="0dp" />   


    

</shape>

最后在你的xml文件里给想要添加的布局 或者按钮加上下面属性即可

<andndroid:background="@drawable/shape">


如果只要左边一侧或者右边一侧有圆角那corners只定义两个值就行,如果设计图显示四个圆角,在手机上运行一下看是否正常即可。

0 0