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

RoundingParams.setBorder(..) does not work #12

Closed
azfarsiddiqui opened this issue Mar 27, 2015 · 7 comments
Closed

RoundingParams.setBorder(..) does not work #12

azfarsiddiqui opened this issue Mar 27, 2015 · 7 comments

Comments

@azfarsiddiqui
Copy link

I am not able to show a border to an image. Neither through code, nor XML.

    GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources());
    RoundingParams roundingParams = RoundingParams.fromCornersRadius(25.0f).setBorder(android.R.color.holo_red_dark, 2.0f);
    GenericDraweeHierarchy hierarchy = builder
            .setFadeDuration(1000)
            .setRoundingParams(roundingParams)
            .setPlaceholderImage(getResources().getDrawable(R.drawable.ic_launcher))
            .build();

    imageView.setHierarchy(hierarchy);
    imageView.setImageURI(uri);
@IanChilds
Copy link
Contributor

Do you see the rounded corners correctly? Is it just the border that is the problem?

@plamenko
Copy link
Contributor

Also, if you add .setOverlayColor(0xFFFFFF00) while building RoundingParams, what happens? This will help us diagnose where the issue might be.

@azfarsiddiqui
Copy link
Author

@IanChilds, I was able to round the image with the code I provided. I am currently only able to circle an image by using:

RoundingParams.asCircle()

@plamenko, If I use setOverlayColor() in conjunction with RoundingParams.asCircle(), the rectangular area holding the circle is painted using that overlay color. However, that color is not drawn over the actual image itself.

if I use setOverlayColor in conjunction with RoundingParams.fromCornersRadius(), there is no effect at all, as the image is itself rectangular therefore no area is left to be filled by the color.

@azfarsiddiqui
Copy link
Author

Alright, I think i've narrowed down the problem. The setBorder() method seems to ignore android color references. For example If I run the following, I don't get expected result:

    RoundingParams roundingParams = RoundingParams.fromCornersRadius(25.0f).setBorder(android.R.color.holo_blue_bright, 5.0f);

However, when I remove the color reference and provide the color value directly, it works as expected:

    RoundingParams roundingParams = RoundingParams.fromCornersRadius(25.0f).setBorder(0xff00ddff, 5.0f);

@plamenko
Copy link
Contributor

Yes, this should be ARGB color, not a resource reference. Both of those use int type, and it makes more sense to interpret it as a color than as a resource id.

@plamenko
Copy link
Contributor

You can always get the color value from the resource id with getResources().getColor(R.color.holo_blue_bright)
I'm glad that you resolved the issue.

@azfarsiddiqui
Copy link
Author

Thanks a lot @plamenko..

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

3 participants