Reputation: 3524
I am using CircleImageView to make an circular image, but I want to overlay a picture overtop of this. Sicne setting CircleImageView
backgroundColor gets rid of the circle (Fill it as a square) I have a regular image view and put it over top of CircleImageView
and set the regular image view .setImageDrawable
to the picture I want. But I need to set the src of the CircleImageView
programtically as a color which I currently have as and int. So I am wondering how I can set the CircleImageView
src programaticlly as a color?
I tried backgroundImage.setBackgroundResource(colorAsInt);
but this gave ERROR: android.content.res.Resources$NotFoundException: Resource ID #0xff7f0106
Thanks
Upvotes: 2
Views: 4268
Reputation: 39191
Since setting the background color defeats the View's intended functionality, it seems the only option is to set the source image. Using a ColorDrawable
of the desired color should work.
backgroundImageImageView.setImageDrawable(new ColorDrawable(colorAsInt));
Upvotes: 3