rounded corners example [example / documentation]
Closed this issue · 5 comments
Thank you for the nice library.
Can you put an example how to make it with round corners ? I've tried but didn't succeed :(
@AndreiD nothing special about it. You just define the corner in pixel:
ActionItemBadge.BadgeStyles.GREY_LARGE.getStyle().setCorner(UIUtil.convertDpToPx(ToolbarActivity.this, 12))
(using one of the provided styles as base)
Or you can also just create your own style
new BadgeStyle(BadgeStyle.Style.LARGE, R.layout.menu_action_item_badge_large, Color.parseColor("#e0e0e0"), Color.parseColor("#c7c7c7"), Color.BLACK).setCorner(UIUtil.convertDpToPx(ToolbarActivity.this, 12)
if you want a rounded badge just define the corner in pixel as the half of the height of the element
.setCorner(UIUtil.convertDpToPx(ToolbarActivity.this, 12)
so 12 dp for a 24dp height badge.
@AndreiD in this case it wouldn't work as the content is bigger than the possible radius can be. (i assume)
yes. this is the case. however I don't know how to fix it :(. it's a menu item image.
You could just use the layout I define in this lib and replace the flexible drawable I define with a real one. So you can do the same without using the lib