Android给布局设置背景色和圆角边框

来源:赵克立博客 分类: Android 标签:Android发布时间:2015-08-05 15:23:04最后更新:2015-08-05 15:23:04浏览:6920
版权声明:
本文为博主原创文章,转载请声明原文链接...谢谢。o_0。
更新时间:
2015-08-05 15:23:04
温馨提示:
学无止境,技术类文章有它的时效性,请留意文章更新时间,如发现内容有误请留言指出,防止别人"踩坑",我会及时更新文章

首先建一个xml文件类型为drawable

<?xml version="1.0" encoding="utf-8"?>  
<shape xmlns:android="http://schemas.android.com/apk/res/android" >  
<!-- 背景色 -->
    <solid android:color="#ffffff" />  
<!-- 边框色 -->
	<stroke  
        android:width="0.01dp"  
        android:color="#C6C7CE" />
    <padding  
        android:bottom="1dp"  
        android:left="0.5dp"  
        android:right="0.5dp"  
        android:top="0dp" />  
<!-- 圆角 -->    
    <corners 
        android:bottomLeftRadius="4dp"
        android:bottomRightRadius="4dp"
        android:topLeftRadius="4dp" 
        android:topRightRadius="4dp" />
</shape>

在使用的地方引用:

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/border_gray"
    android:orientation="vertical"
    android:padding="10dp" >



微信号:kelicom QQ群:215861553 紧急求助须知
Win32/PHP/JS/Android/Python