Label
Last Updated On 2021-07-16
Version 5MinSDK 7Tutorial Video
A Label displays a piece of text, which is specified through the Text
property. Other properties, all of which can be set in the Designer or Blocks Editor, control the appearance and placement of the text.
Properties
You can set the below properties in the UI part of the builder.
- BackgroundColor - it's a color value which is set to &h00ffffff by default.
- Clickable - it's a boolean value which is set to true by default.
- CustomFontTypeFace - it's a asset value which is set to blank by default.
- Ellipsize - it's a choices value which is set to none by default.
- FontBold - it's a boolean value which is set to false by default.
- FontItalic - it's a boolean value which is set to false by default.
- FontSize - it's a non negative float value which is set to 14.0 by default.
- FontTypeface - it's a typeface value which is set to 0 by default.
- HTMLFormat - it's a boolean value which is set to false by default.
- HasMargins - it's a boolean value which is set to true by default.
- HeihMargin - it's a four value which is set to 0,0,0,0 by default.
- HeihPadding - it's a four value which is set to 0,0,0,0 by default.
- JustifyContent - it's a boolean value which is set to false by default.
- LongClickable - it's a boolean value which is set to false by default.
- MarginBottom - it's a non negative float value which is set to 0 by default.
- MarginLeft - it's a non negative float value which is set to 0 by default.
- MarginRight - it's a non negative float value which is set to 0 by default.
- MarginTop - it's a non negative float value which is set to 0 by default.
- MaxLines - it's a integer value which is set to 0 by default.
- Opacity - it's a integer value which is set to 0 by default.
- PaddingBottom - it's a non negative float value which is set to 0 by default.
- PaddingLeft - it's a non negative float value which is set to 0 by default.
- PaddingRight - it's a non negative float value which is set to 0 by default.
- PaddingTop - it's a non negative float value which is set to 0 by default.
- Selectable - it's a boolean value which is set to false by default.
- ShowLinks - it's a choices value which is set to none by default.
- Text - it's a textArea value which is set to blank by default.
- TextAlignment - it's a textalignment value which is set to 0 by default.
- TextColor - it's a color value which is set to &hff000000 by default.
- Visible - it's a visibility value which is set to true by default.
- WordSpacing - it's a integer value which is set to 1 by default.
Block Properties
You can set the below blocks properties in the blocks section of the builder.
BackgroundColor
Returns the label's background color as an alpha-red-green-blue integer.
Clickable
Specifies whether the image should be clickable or not.
CountLines
Return the number of lines
CustomFontTypeFace
Sets the custom font
Ellipsize
Property for Ellipsize
FontSize
Returns the label's text's font size, measured in sp(scale-independent pixels).
HTMLContent
Returns the content of the Label as HTML. This is only useful if the HTMLFormat property is true.
HasMargins
Reports whether or not the label appears with margins. All four margins (left, right, top, bottom) are the same. This property has no effect in the designer, where labels are always shown with margins.
Height
Specifies the vertical height of the Label, measured in pixels.
HeightPercent
Specifies the vertical height of the Label as a percentage of the height of the Screen.
JoinText
Join text in label inline or in new line
JustifyContent
If true then justified contents by stretching spaces.
LineSpacing
Set Line Spacing. From 0.0 to nth value
LongClickable
Specifies whether the image should be long clickable or not.
MarginBottom
Property for MarginBottom
MarginLeft
Property for MarginLeft
MarginRight
Property for MarginRight
MarginTop
Property for MarginTop
MaxLines
Property for MaxLines
Opacity
Set opacity value between 1 to 10
PaddingBottom
Property for PaddingBottom
PaddingLeft
Property for PaddingLeft
PaddingRight
Property for PaddingRight
PaddingTop
Property for PaddingTop
Selectable
Set test to selectable
ShowLinks
Highlight the links, phone numbers and email addresses. Clicking on it will load the given URI
Text
Returns the text displayed by the label.
TextColor
Returns the label's text color as an alpha-red-green-blue integer.
Visible
Specifies whether the Label should be visible on the screen. Value is true if the Label is showing and false if hidden.
Width
Specifies the horizontal width of the Label, measured in pixels.
WidthPercent
Specifies the horizontal width of the Label as a percentage of the width of the Screen.
WordSpacing
Set space between words
Methods
You can set the below method blocks in the blocks section of the builder.
SetShadow
Set shadow under the text
Events
You can set the below event blocks in the blocks section of the builder.
Click
Triggers when label clicked
LongClick
Triggers when label long clicked