Get associated image (Drawable) in ImageView android
问题 i set a image to a imageview control in android: iv.setImageResource(R.drawable.image1); i want to get this associated Drawable, looks like: Drawable myDrawable = iv.getImageResource(); //wrong thanks! 回答1: You can get the drawable like Drawable myDrawable = iv.getDrawable(); You can compare it with a drawable resource like if(iv.getDrawable()==getResources().getDrawable(R.drawable.image1)){ //do work here } 回答2: Define the Drawable first. Drawable myDrawable = getResources().getDrawable(R