Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

BadgeLabel

IGR777 edited this page Aug 30, 2018 · 6 revisions

It's a label control, that has colored background.

Badge Label

Inherits from AppCompatTextView/UILabel.

Customization fields

FontStyleItem FontStyle - responsible for font customization.

UIFont Font - is overridden native property, which is responsible for label's text font.

Typeface Typeface - is overridden native property, which is responsible for label's text font.

float LetterSpacing – is a new property for IOS platform and overridden for Android platform. It is responsible for label's text letters spacing.

float TextSize - is a new property for IOS platform and overridden for Android platform. It is responsible for label title text size.

UIColor TextColor - overridden property, responsible for label text color.

Color TextColor - respo### nsible for label text color.

intfloat CornerRadius - set corner radius for the background.

UIColor BackgroundColor - overridden property, responsible for background color of the badge label.

Color BackgroundColor - responsible for background color of the badge label.

Usage

Android

For Android platform, there are two ways to add BadgeLabel to the layout: to the axml markup file or from the code behind.

The sample for creating BadgeLabel in code behind for Android:

var label = new BadgeLabel(this.Context);
label.TextSize = 15;
label.LetterSpacing = 3;
label.CornerRadius = 8;
label.BackgroundColor = Color.Red;

The sample for creating BadgeLabel in axml markup for Android:

<EOS.UI.Droid.Controls.BadgeLabel
    android:id="@+id/badgeLabel"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Badge label" />

Note: For customization Typeface you should add a file with a custom font to assets.

iOS

For iOS Badge label can be added from the .xib/storyboards files or from code behind.

The sample for creating BadgeLabel in code behind for IOS:

var label = new BadgeLabel();
label.TextSize = 15;
label.LetterSpacing = 3;
label.CornerRadius = 8;
label.BackgroundColor = UIColor.Red;
label.FontStyle = new FontStyleItem() {
       Color = ColorExtension.FromHex(brandPrimaryColor),
       Font = UIFont.SystemFontOfSize(13f, UIFontWeight.Semibold),
       Size = 13f,
       LetterSpacing = -0.6f,
       LineHeight = 15f
}
Clone this wiki locally