2.5 创建颜色渐变效果(xml配置文件)

前端之家收集整理的这篇文章主要介绍了2.5 创建颜色渐变效果(xml配置文件)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。









shape Drawable 形状资源



<? xml version = "1.0" encoding = "utf-8" ?>
< shape xmlns:android = "http://schemas.android.com/apk/res/android"
android:shape = "rectangle" >
< corners //边角弧度,可以设置圆角矩形
android:topLeftRadius = "2dip"
android:topRightRadius = "2dip"
android:bottomLeftRadius = "2dip"
android:bottomRightRadius = "2dip"
/>
< gradient //颜色渐变
android:startColor = "#66ff00"
android:endColor = "#5566ff00"
android:angle="90" //渐变角度 0:水平渐变 90:数值渐变
></ gradient >
< padding //距离控件边距
android:left = "5dip"
android:top = "5dip"
android:right = "5dip"
android:bottom = "5dip"
></ padding >


<stroke //指定边框
android:width="1dip" //边框宽度
android:color="#000000"

android:dashWidth="10dip" //边框虚线长度
android:dashGap="5dip" //边框虚线间隙
></stroke>



</ shape >
原文链接:https://www.f2er.com/xml/299655.html

猜你在找的XML相关文章