Open jhovelnu opened 1 year ago
The issue is on the BadgeView.cs
When the Position Center is set the badged is showed, but in other Position the badge is not showed because the margin position.
private void ApplyLayoutParams() { var layoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
if (!_hasWrappedLayout)
{
var targetParams = ((FrameLayout.LayoutParams)Target.LayoutParameters);
var w = targetParams.Width / 2;
var h = targetParams.Height / 2;
layoutParameters.Gravity = GravityFlags.Center;
switch (Postion)
{
case BadgePosition.PositionTopLeft:
layoutParameters.SetMargins(_badgeMarginL - w, _badgeMarginT - h, 0, 0);
break;
case BadgePosition.PositionTopRight:
layoutParameters.SetMargins(0, _badgeMarginT - h, _badgeMarginR - w, 0);
break;
case BadgePosition.PositionBottomLeft:
layoutParameters.SetMargins(_badgeMarginL - w, 0, 0, 0 + _badgeMarginB - h);
break;
case BadgePosition.PositionBottomRight:
layoutParameters.SetMargins(0, 0, _badgeMarginR - w, 0 + _badgeMarginB - h);
break;
case BadgePosition.PositionCenter:
layoutParameters.SetMargins(_badgeMarginL, _badgeMarginT, _badgeMarginR, _badgeMarginB);
break;
case BadgePosition.PositionTopCenter:
layoutParameters.SetMargins(0, 0 + _badgeMarginT - h, 0, 0);
break;
case BadgePosition.PositionBottomCenter:
layoutParameters.SetMargins(0, 0, 0, 0 + _badgeMarginB - h);
break;
case BadgePosition.PositionLeftCenter:
layoutParameters.SetMargins(_badgeMarginL - w, 0, 0, 0);
break;
case BadgePosition.PositionRightCenter:
layoutParameters.SetMargins(0, 0, _badgeMarginR - w, 0);
break;
}
}
The plugin does not work on the last xamarin.forms version:
On Android app the badge can be showed
On IOS app the background color does not work
Can you please update this Plugin with the latest version for xamarin.forms?