This can only be accomplished in API 11+ if your background is a solid color.
int color = Color.TRANSPARENT;
Drawable background = view.getBackground();
if (background instanceof ColorDrawable)
color = ((ColorDrawable) background).getColor();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…