TextView

Example

from enamlnative.core.api import *
from enamlnative.widgets.api import *

enamldef ContentView(LinearLayout): drawer:
    orientation = 'vertical'
    TextView:
        # Set input type to html
        input_type = 'html'
        text = "You <i>are</i> <b>really</b> <font color='red'>awesome</font>!"
    TextView:
        text_size = 20
        text = "Regular text"
    TextView:
      text = "Error"
      font_style = "italic"
      text_size = 16
      text_color = "#FF0000"
    TextView:
      text = "This takes up three lines, can be selected, and shared."
      text_selectable = True
      lines = 3
    TextView:
      text = """This gets trunicated. Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32."""
      max_lines = 5

Declaration

class enamlnative.widgets.text_view.TextView(parent=None, **kwargs)[source]

Bases: enamlnative.widgets.view.View

A simple control for displaying read-only text.

all_caps

Sets the properties of this field to transform input to ALL CAPS display.

Sets the autolink mask of the text.

editor_actions

Listen for edit actions

editor_action

Listen for editor actions

input_type

Input type or types separated by “|” See https://developer.android.com/reference/android/widget/TextView.html attr_android:inputType

font_family

Font family

font_style

Font style

highlight_color

Sets the color used to display the selection highlight.

Sets the color of links in the text.

text

The unicode text for the label.

text_alignment

Text alignment

text_color

Sets the text color for all the states (normal, selected, focused) to be this color.

text_size

Set the default text size to the given value, interpreted as “scaled pixel” units.

text_selectable

Set text s

lines

Sets the height of the TextView to be exactly lines tall.

line_spacing

Sets the line spacing

letter_spacing

Sets the line spacing

max_lines

Sets the height of the TextView to be at most maxLines tall.

proxy

A reference to the ProxyLabel object.

append_text(text)[source]

Add text to the existing text

Android Implementation

class enamlnative.android.android_text_view.AndroidTextView[source]

Bases: enamlnative.android.android_view.AndroidView, enamlnative.widgets.text_view.ProxyTextView

An Android implementation of an Enaml ProxyTextView.

widget

A reference to the widget created by the proxy.

create_widget()[source]

Create the underlying widget.

init_widget()[source]

Initialize the underlying widget.

set_text(text)[source]

Set the text in the widget.

No iOS implementation found.