Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set background color for the Circle View? #64

Closed
safaiyeh opened this issue Jun 23, 2015 · 13 comments
Closed

How to set background color for the Circle View? #64

safaiyeh opened this issue Jun 23, 2015 · 13 comments

Comments

@safaiyeh
Copy link

Setting the background color, colors the whole image view. How do I only color the circle view?
11642035_994392247268422_962917052_o

@hdodenhof
Copy link
Owner

There's an incomplete PR for this: #45 - I still need to find some time to cleanup and merge that one.

@hdodenhof
Copy link
Owner

Quick workaround:

CircleImageView imageView = ...

Drawable color = new ColorDrawable(getResources().getColor(R.color.foo));
Drawable image = getResources().getDrawable(R.drawable.bar);

LayerDrawable ld = new LayerDrawable(new Drawable[]{color, image});
imageView.setImageDrawable(ld);

@safaiyeh
Copy link
Author

Thanks, the workaround worked great.

samigehi added a commit to samigehi/CircleImageView that referenced this issue Oct 24, 2015
samigehi added a commit to samigehi/CircleImageView that referenced this issue Oct 24, 2015
@Shreyas-R
Copy link

Shreyas-R commented Oct 6, 2016

Still if you use xml way of setting background, it applies to whole rectangular button view. It wont apply only to circle view. And background tint doesn't work for this view.

@hdodenhof
Copy link
Owner

@Shreyas-R in XML you can now use the civ_fill_color attribute.

@Shreyas-R
Copy link

Like android:civ_fill_color=..... ??

@hdodenhof
Copy link
Owner

hdodenhof commented Oct 6, 2016

app:civ_fill_color="@color/foobar"

@Shreyas-R
Copy link

Shreyas-R commented Oct 6, 2016

Using app: gives no Resource identifier error

Edit: Had old version of your gradle plugin. Updated now. Working fine. Thanks man

@xbaker
Copy link

xbaker commented Jan 3, 2017

imageView.setFillColor(R.color.yourcolor)

@madhavkate
Copy link

How to set Image from Url ..... Please tell me

@GibranPolonsky
Copy link

GibranPolonsky commented Aug 22, 2017

@madhavkate You can use an external library such as Picasso.

Repository owner deleted a comment from madhavkate Aug 22, 2017
Repository owner deleted a comment from madhavkate Aug 22, 2017
Repository owner deleted a comment from madhavkate Aug 22, 2017
@Ananthusubramanian
Copy link

@madhavkate
Picasso example for loading the image from url :
Picasso.with(context).load(image_link).placeholder(R.drawable.pic).into(ImageView);

@iamsb1896
Copy link

Try this:
app:civ_circle_background_color="@color/gray"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants