私は2つのドロウアブルを比較しようとしていますが、成功しません。私はいくつかの研究をしました、同様の質問さえありますが、助けにはなりませんでした。2つのドロウアブル内のリソースを比較する
私のアプリでは、getCompoundDrawablesWithIntrinsicBounds
を使用して、EditTextの正しい位置にImageViewを表示します。 次に、どのイメージリソースがそこに配置されているかを確認する必要があります。
この小さなサンプルはうまくいくはずですか?しかし、それは "等しくない"を返す。
Drawable drawable1 = ContextCompat.getDrawable(getApplicationContext(),R.drawable.cor);
Drawable drawable2 = ContextCompat.getDrawable(getApplicationContext(),R.drawable.cor);
if(drawable1 == drawable2){
System.out.println("equal");
}else{
System.out.println("not equal");
}
あなたはImageViewの上でこれらのドローアブルを適用していますか? –
http://stackoverflow.com/questions/9125229/comparing-two-drawables-in-android – sasikumar