1.颜色, 是可以设置透明属性的,正常是都是100%不透明。
<color name="white">#ffffff</color>
调整透明度后
<color name="hintWhite">#77ffffff</color>
如何设置:在AS中点击颜色,最下方的Opacity,是透明度,0-255
2.设置EditText取消底部横线
style="?android:attr/textViewStyle"
android:background="@null"
3.总览设置渐变色,边角,实心/空心,边框
创建 在该文件夹下res/drawable/xxxx. xml
调用 android:background=”@drawable/xxxx.xml”
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape=["rectangle" | "oval" | "line" | "ring"] > --- 默认为rectangle
<corners -- shape=“rectangle”时使用,
android:radius="integer" -- 半径,会被下边的属性覆盖,默认为1dp,
android:topLeftRadius="integer"
android:topRightRadius="integer"
android:bottomLeftRadius="integer"
android:bottomRightRadius="integer" />
<gradient -- 渐变
android:angle="integer"
android:centerX="integer"
android:centerY="integer"
android:centerColor="integer"
android:endColor="color"
android:gradientRadius="integer"
android:startColor="color"
android:type=["linear" | "radial" | "sweep"]
android:useLevel=["true" | "false"] />
<padding
android:left="integer"
android:top="integer"
android:right="integer"
android:bottom="integer" />
<size -- 指定大小,一般用在imageview配合scaleType属性使用。大小一般会适配滴
android:width="integer"
android:height="integer" />
<solid -- 填充颜色,可是是十六进制颜色。(比如想设置半透明效果,直接使用十六就只就OK)
android:color="color" />
<stroke -- 指定边框,border,dashWidth和dashGap有一个为0dp则为实线
android:width="integer"
android:color="color"
android:dashWidth="integer" -- 虚线宽度
android:dashGap="integer" /> -- 虚线间隔宽度
</shape>
渐变色
<!--android:startColor="#aa000000" 渐变起始色值
android:centerColor="" 渐变中间色值
android:endColor="#ffffffff" 渐变结束颜色
android:angle="45" 渐变的方向 默认为0 从做向右 ,90时从下向上 必须为45的整数倍
android:type="radial" 渐变类型 有三种 线性linear 放射渐变radial 扫描线性渐变sweep
android:centerX="0.5" 渐变中心相对X坐标只有渐变类型为放射渐变时有效
android:centerY="0.5" 渐变中心相对Y坐标只有渐变类型为放射渐变时有效
android:gradientRadius="100" 渐变半径 非线性放射有效
-->
<gradient
android:startColor="#000000"
android:endColor="#ffffff"
android:type="sweep"
android:centerX="0.5"
android:centerY="0.5"
android:gradientRadius="100"/>
白色边框,半透明效果
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="16dp" />
<!-- 这是半透明,还可以设置全透明,那就是白色边框的效果了 -->
<solid android:color="#80065e8d" />
<stroke
android:dashGap="0dp"
android:width="4dp"
android:color="@android:color/white" />
</shape>
单边曲角效果
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp"
android:bottomLeftRadius="30dp"
android:bottomRightRadius="30dp"/>
</shape>
oval 椭圆 ring 环形物 rectangle 矩形 line 线 opacity 不透明性
附上一份颜色进制图,需要的可以查阅: http://blog.sina.com.cn/s/blog_684a1d160100umuq.html