Hashan Rathanayake
Hashan Rathanayake

Reputation: 25

Setting a bitmap to a image view after setting a background resource

I set a background resource to a image view then I tried to set a bitmap image to the same image view but then the bitmap image is appearing on top of the background resource. How can i remove this background resource and set a bitmap image

Upvotes: 1

Views: 1093

Answers (1)

Zahidul Islam
Zahidul Islam

Reputation: 3190

When you use setBipmap(bitmap) . It actually set like a android:src="IMAGE" . So it's overlapping to your background image. So, you have 2 choices.

  • set the background image as a image src. exmp : android:src="@drawable/IMAGE". So whe you set the bitmap it won't overlap.
  • Or , You can set the bitmap as the background of that imageview . like this imageView.setBackground(new BitmapDrawable(getResources(), BIMAP));

Upvotes: 1

Related Questions