<?xml version = "1.0" encoding = "utf-8"?>
<bitmap
xmls:android="http://schemas.android.com/apk/res/android"
android:src="@[package:]drawable/drawable_resource"
android:antialias=["true"|"false"]//抗锯齿
android:dither=["true"|"false"]//开启抖动效果
android:filter=["true"|"false"]//过滤效果
android:gravity
android:tileMode /> //平铺模式
<?xml version = "1.0" encoding = "utf-8"?>
<shape
xmls:android="http://schemas.android.com/apk/res/android"
android:shape=["rectangle"|"oval"|"line"|"ring"]>
<corners/> //四个角的角度,只适应矩形shape
<gradient/> //渐变效果
<padding/> //包含这个drawable的view的空白
<size/> //大小,width&height
<solid/> //纯色填充
<stroke/> //shape的描边
</shape>
<?xml version = "1.0" encoding = "utf-8"?>
<layer-list
xmls:android="http://schemas.android.com/apk/res/android"
<item
android:drawable=""
android:id=""
android:top=""//drawable相对于view上下左右偏移量
android:right=""
android:bottom=""
android:left=""/>
</layer-list>
TransitionDrawable drawable = (TransitionDrawable) mBtn.getBackground();
drawable.startTransition(5000);
ScaleDrawable drawable = (ScaleDrawable) mBtn.getBackground();
drawable.setLevel(8000);
原文:http://www.cnblogs.com/fruitbolgs/p/5203026.html