安卓ImageView获取图片信息比较:
//获取当前图片ConstantState类对象
Drawable.ConstantState constantState = mIv_njlb.getDrawable().getCurrent().getConstantState();
//获取需要比较的图片ConstantState类对象
Drawable.ConstantState t2 = getDrawable(R.mipmap.xiala).getConstantState();
if (constantState.equals(t2)) {
mIv_njlb.setImageResource(R.mipmap.shangla);
} else {
mIv_njlb.setImageResource(R.mipmap.xiala);
}