如何获取Button中的Drawable

Drawable img1 = button.getCompoundDrawables()[0];

与其他Drawable比较

Drawable img2 = getResources().getDrawable(R.drawable.name);
Bitmap bitmap1 = ((BitmapDrawable)img1).getBitmap();
Bitmap bitmap2 = ((BitmapDrawable)img2).getBitmap();
if(bitmap1==bitmap2){
    ...     
}