ANDROID笔记:shape的简单使用

/res/drawable/shape1

 

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <!-- 圆角 -->
    <corners android:radius="8dp" />
    <!-- 填充色 -->
    <solid android:color="#ff0000" />
    <!-- 边框 -->
    <stroke
        android:width="4dp"
        android:color="#00ff00" />
    <!-- 内边距 -->
    <padding
        android:left="10dp"
        android:top="10dp" />
    <!-- 渐变色 -->
    <gradient
        android:angle="180"
        android:centerColor="#0000"
        android:endColor="#00ff00"
        android:startColor="#ff0000" />

</shape>

使用:

android:background="@drawable/shape1"

 

效果:

posted @ 2013-10-25 11:25  skyko  阅读(184)  评论(0编辑  收藏  举报