android监听imageview移动,Android应用开发之android 判断ImageView当前显示的是哪一张图片...

本文将带你了解Android应用开发之android   判断ImageView当前显示的是哪一张图片,希望本文对大家学Android有所帮助。

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

Java代码    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);      }  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频道!