Drawable bg= getBackground();
//bg包括color和Drawable
if (bg instanceof ColorDrawable) {
ColorDrawable colordDrawable = (ColorDrawable) bg;
int color = colordDrawable.getColor();
paint.setColor(color);
setBackgroundDrawable(null);
} else {
bgBitmap = ((BitmapDrawable) bg).getBitmap();
setBackgroundDrawable(null);
}
//bg包括color和Drawable
if (bg instanceof ColorDrawable) {
ColorDrawable colordDrawable = (ColorDrawable) bg;
int color = colordDrawable.getColor();
paint.setColor(color);
setBackgroundDrawable(null);
} else {
bgBitmap = ((BitmapDrawable) bg).getBitmap();
setBackgroundDrawable(null);
}