`

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);
	}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics