ImageView a=(ImageView)findViewById(R.id.imageView2);
                //获取当前图片ConstantState类对象
                Drawable.ConstantState t1=  a.getDrawable().getCurrent().getConstantState();
                //找到需要比较的图片ConstantState类对象
                Drawable.ConstantState t2=getDrawable(R.drawable.ok).getConstantState();
                if(t1.equals(t2))
                {
                    a.setImageResource(R.drawable.ok2);
                }
                else{
                    a.setImageResource(R.drawable.ok);
                }

 

相关文章:

  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
  • 2021-10-25
  • 2022-12-23
猜你喜欢
  • 2021-11-17
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2021-12-19
相关资源
相似解决方案