drawable == drawable?

前端 未结 5 437
盖世英雄少女心
盖世英雄少女心 2021-01-03 01:56

This is my problem...:

In my activity I have an ImageView and a Button. I want the Button to perform an action ONLY when the ImageVie

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-03 02:51

    variabledrawable and acertaindrawable aren't the same Object, even though they might display the same drawable.

    If android doesn't give you a built-in way to compare drawables (i guess it depends on the concrete drawable you have), my advice to you is to Extend the Drawable class that you are using and add a private field that holds some kind of ID so that you can compare between drawables.

提交回复
热议问题