自定义输入框,按钮边框,颜色

来源:互联网 发布:平面设计用到哪些软件 编辑:程序博客网 时间:2024/05/16 01:12

设置输入框或者按钮background:@drawable/btn_press

新建btn_press.xml,定义如下:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="false" >
        <shape>
            <!-- 渐变 -->
            <gradient
                    android:startColor="#ff8c00"
                    android:endColor="#FFFFFF"
                    android:type="radial"
                    android:gradientRadius="50" />
            <!-- 描边 -->
            <stroke
                    android:width="2dp"
                    android:color="#dcdcdc"
                    android:dashWidth="5dp"
                    android:dashGap="3dp" />
            <!-- 圆角 -->
            <corners
                    android:radius="4dp" />
            <padding
                    android:left="20dp"
                    android:top="20dp"
                    android:right="20dp"
                    android:bottom="20dp" />
        </shape>
    </item>
</selector>


0 0