Drawable
with ImageView with getDrawable () to get theAnd
getBaseContext (). getResources (). getDrawable () to obtain the picture is inconsistent?
For example, drawable: R.drawable.l, first set ImageView iv.setImageResource (R.drawable.l);
Then iv.getDrawable ()And
getBaseContext (). getResources (). getDrawable (R.drawable.l)
Get drawable not equal?
With == and equals are not equal, is how is it?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Why the difference?
Two drawable objects.
Png images may share the same one, but it should still be two two drawable objects.
Reply:
Under the circumstances do not add extra signs, how can I judge that the two are not the same picture?
Reply:
Whether the landlord's problem has been solved? I have encountered this problem
Reply:
Reads an image file from the sd card, how to set the path to getDrawable in to or have other ways to set the path to come
Reply:
Landlord great God? I have encountered this problem, SOS ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Reply:
Not solve ah. Then look at this question is no, there should be other ways to judge is not the same object, such as id value or path.
Reply:
After setting iv.setImageResource (R.drawable.l) after, but also with getResources (). GetDrawable (R.drawable.l), rather than iv.getDrawable ().
You call getDrawable (R.drawable.l) twice, will get two different objects, because it will get two new ImageDrawable ().
You can use Drawable.getConstantState () to compare them, of course, sometimes being given.
Reply:
Compare ConstantState object,
Similar:
ConstantState icon = mContext.getResources () getDrawable (R.drawable._smsmms) getConstantState ();..
ConstantState icon2 = imageView.getBackGround () getConstantState ().;
No comments:
Post a Comment