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

SimpleLabel

IGR777 edited this page Oct 9, 2018 · 5 revisions

Label which supports customization.

Inherits from AppCompatTextView/UILabel.

Customization fields

Type Field Description Default value
FontStyleItem FontStyle Responsible for font customization.
UIFont
Typeface
Font
Typeface
Responsible for label's title font. System
Roboto bold
float LetterSpacing Responsible for label's text letters spacing. -0.0046
float TextSize Responsible for label title text size. 13
UIColor
Color
TextColor Responsible for label text color. #3C6DF0

Usage

Android

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

The sample for creating BadgeLabel in code behind for Android:

var simpleLabel = new SimpleLabel(Context);
simpleLabel.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
simpleLabel.TextSize = 15;
simpleLabel.LetterSpacing = 3;
simpleLabel.TextColor = Color.Red;

Sample for creating SimpleLabel in axml markup for Android:

<EOS.UI.Droid.Controls.SimpleLabel
    android:id="@+id/simpleLabel"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Simple label" />

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

iOS

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

The sample for creating SimpleLabel in code behind for IOS:

var simpleLabel = new SimpleLabel();
simpleLabel.Frame = new CGRect(0, 0, 65, 20);
simpleLabel.TextSize = 15;
simpleLabel.LetterSpacing = 3;
simpleLabel.FontStyle = new FontStyleItem() {
    Color = ColorExtension.FromHex(MyColor),
    Font = UIFont.SystemFontOfSize(13f, UIFontWeight.Semibold),
    Size = 13f,
    LetterSpacing = -0.6f,
    LineHeight = 15f
}