android 判断ImageView当前显示的是哪一张图片

判断ImageView当前显示的是哪一张图片
private void init2() {
          Drawable drawable = getResources().getDrawable(R.drawable.wear_collection_del); 
			ivCollection.setBackground(drawable);
		ConstantState buttonConstantState = ivCollection.getBackground()
				.getConstantState();
		ConstantState resourceConstantState = getResources().getDrawable(
				R.drawable.wear_collection_del).getConstantState();
		boolean isEqual = buttonConstantState.equals(resourceConstantState);
		System.out.println("isEqual=" + isEqual);
	}

你可能感兴趣的:(android)