Skip to main content

TextView

Overview

Text view

Example

<TextView android:layout_height="wrap_parent"
android:layout_width="match_parent"
android:tag="btn"
android:text="Button"
android:textColor="#669999"
android:textSize="14dp"
android:gravity="center"
android:maxLength="12"
/>

Properties

Common Properties

See Common Properties

Private Properties

PropertyDescriptionValues
layout_weightChild weightNumber
When the parent is LinearLayout, child controls can set weight
gravityInternal control alignmentUsage reference
top
bottom
left
right
center_vertical
fill_vertical
center_horizontal
fill_horizontal
center
fill
clip_vertical
clip_horizontal
textText contentString
textColorText colorHex, e.g. #FFFFFF
textSizeText sizespecific number + dp
maxLengthMaximum text lengthspecific number
linesNumber of linesspecific number
maxLinesMaximum linesspecific number
ellipsizeTruncation when text exceeds widthstart: ellipsis at start
end: ellipsis at end
middle: ellipsis in middle
marquee: horizontal scroll (requires focus)
none: no truncation