TextView
An element which is used for displaying text content on screen. If text to be displayed is generated on the fly then use "not-translate" property to disable text translation lookup
Create from source
func NewTextView(session Session, params Params) TextView
Create new text view object and returns its interface
Create from resource
TextView {
id = textView,
text = "Hello",
not-translate = true,
}
Interface description
Inherit methods, properties and events from View
Properties
Inherits from View
all properties of text parameters ("font-name", "text-size", "text-color", etc.)
"not-translate"
Controls whether the text set for the text view require translation. This is an inherited property, i.e. if it is not defined, then the value of the parent view is used. Default value is false
Constant: NotTranslate
Types: bool
, int
, string
Values
bool | int | string | Description |
---|---|---|---|
true |
1 |
"true", "yes", "on", "1" | No need to lookup for text translation in resources |
false |
0 |
"false", "no", "off", "0" | Lookup for text translation |
"text"
Text to display
Constant: Text
Types: string
Examples
TextView {
text = "Some text",
text-color = blue,
}
text := rui.NewTextView(session, rui.Params{
rui.Text: "Some text",
rui.TextColor: rui.Blue,
})
"text-overflow"
Sets how hidden overflow content is signaled to users. Default value is "clip"
Constant: TextOverflow
Types: int
, string
Values
int | string | Description |
---|---|---|
0 (TextOverflowClip ) |
"clip" | Text is clipped at the border |
1 (TextOverflowEllipsis ) |
"ellipsis" | At the end of the visible part of the text "…" is displayed |
Related global functions
func GetNotTranslate(view View, subviewID ...string) bool
Returns the "not-translate" property value of the subview. If the second argument (subviewID) is not specified or is an empty string then a value from the first argument (view) is returned
func GetTextOverflow(view View, subviewID ...string) int
Returns a value of the "text-overflow" property: TextOverflowClip
(0) and TextOverflowEllipsis
(1). If the second argument (subviewID) is not specified or is an empty string then a value from the first argument (view) is returned
func TextViewByID(rootView View, id string) TextView
Return a TextView
with id equal to the argument of the function or nil if there is no such View or View is not TextView