Issue
ImageView coloring = findViewById(R.id.badge1);
coloring.setImageResource(R.drawable.coins);
when I set the image view drawable programmatically , it adds the new drawable but keep the previous one in the background like this
I tried
coloring.setImageResource(0);
coloring.setImageDrawable(null);
but it still kept.
Solution
This is because in layout.xml you set background to your imageView try this in layout.xml to your image
android:src="@drawable/your_drawable"
instead of
android:background="@drawable/your_drawable"
Answered By - Santanu Sur
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.