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);
	}

猜你喜欢

转载自gzsxt.iteye.com/blog/2267421