TextView

TextViewのクラス階層

  • View
    • TextView
      • Button
        • CompoundButton
          • CheckBox
          • RadioButton
          • ToggleButton
      • CheckedTextView
      • Chronometer
      • DigitalClock
      • EditText
        • AutoCompleteTextView
        • ExtractEditText

属性 (Attribute)

属性 説明
android:autoLink Controls whether links such as urls and email addresses are automatically found and converted to clickable links.
android:autoText If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors.
android:bufferType Determines the minimum type that getText() will return.
android:capitalize If set, specifies that this TextView has a textual input method and should automatically capitalize what the user types.
android:cursorVisible Makes the cursor visible (the default) or invisible.
android:digits If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept.
android:drawableBottom The drawable to be drawn below the text.
android:drawableLeft The drawable to be drawn to the left of the text.
android:drawablePadding The padding between the drawables and the text.
android:drawableRight The drawable to be drawn to the right of the text.
android:drawableTop The drawable to be drawn above the text.
android:editable If set, specifies that this TextView has an input method.
android:editorExtras Reference to an <input-extras> XML resource containing additional data to supply to an input method, which is private to the implementation of the input method.
android:ellipsize If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle.
android:ems Makes the TextView be exactly this many ems wide.
android:enabled Specifies whether the TextView is enabled or not.
android:freezesText If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position.
android:gravity Specifies how to align the text by the view's x- and/or y-axis when the text is smaller than the view.
android:height Makes the TextView be exactly this many pixels tall.
android:hint Hint text to display when the text is empty.
android:imeActionId Supply a value for EditorInfo.actionId used when an input method is connected to the text view.
android:imeActionLabel Supply a value for EditorInfo.actionLabel used when an input method is connected to the text view.
android:imeOptions Additional features you can enable in an IME associated with an editor to improve the integration with your application.
android:includeFontPadding Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly.
android:inputMethod If set, specifies that this TextView should use the specified input method (specified by fully-qualified class name).
android:inputType テキストフィールドで使用されるデータタイプ。これによりInput methodはユーザー入力を処理する方法を決定する。android:inputType - TextView | Android Developers
android:lineSpacingExtra Extra spacing between lines of text.
android:lineSpacingMultiplier Extra spacing between lines of text, as a multiplier.
android:lines Makes the TextView be exactly this many lines tall.
android:linksClickable If set to false, keeps the movement method from being set to the link movement method even if autoLink causes links to be found.
android:marqueeRepeatLimit The number of times to repeat the marquee animation.
android:maxEms Makes the TextView be at most this many ems wide.
android:maxHeight Makes the TextView be at most this many pixels tall.
android:maxLength Set an input filter to constrain the text length to the specified number.
android:maxLines Makes the TextView be at most this many lines tall.
android:maxWidth Makes the TextView be at most this many pixels wide.
android:minEms Makes the TextView be at least this many ems wide.
android:minHeight Makes the TextView be at least this many pixels tall.
android:minLines Makes the TextView be at least this many lines tall.
android:minWidth Makes the TextView be at least this many pixels wide.
android:numeric If set, specifies that this TextView has a numeric input method.
android:password Whether the characters of the field are displayed as password dots instead of themselves.
android:phoneNumber If set, specifies that this TextView has a phone number input method.
android:privateImeOptions An addition content type description to supply to the input method attached to the text view, which is private to the implementation of the input method.
android:scrollHorizontally Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally).
android:selectAllOnFocus If the text is selectable, select it all when the view takes focus instead of moving the cursor to the start or end.
android:shadowColor Place a shadow of the specified color behind the text.
android:shadowDx Horizontal offset of the shadow.
android:shadowDy Vertical offset of the shadow.
android:shadowRadius Radius of the shadow.
android:singleLine Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key.
android:text 表示するテキスト。これはStringリソースで指定すべき
android:textAppearance Base text color, typeface, size, and style.
android:textColor Text color.
android:textColorHighlight Color of the text selection highlight.
android:textColorHint Color of the hint text.
android:textColorLink Text color for links.
android:textCursorDrawable Reference to a drawable that will be drawn under the insertion cursor.
android:textEditNoPasteWindowLayout Variation of textEditPasteWindowLayout displayed when the clipboard is empty.
android:textEditPasteWindowLayout The layout of the view that is displayed on top of the cursor to paste inside a TextEdit field.
android:textEditSideNoPasteWindowLayout Variation of textEditSidePasteWindowLayout displayed when the clipboard is empty.
android:textEditSidePasteWindowLayout Used instead of textEditPasteWindowLayout when the window is moved on the side of the insertion cursor because it would be clipped if it were positioned on top.
android:textIsSelectable Indicates that the content of a non-editable text can be selected.
android:textScaleX Sets the horizontal scaling factor for the text.
android:textSelectHandle Reference to a drawable that will be used to display a text selection anchor for positioning the cursor within text.
android:textSelectHandleLeft Reference to a drawable that will be used to display a text selection anchor on the left side of a selection region.
android:textSelectHandleRight Reference to a drawable that will be used to display a text selection anchor on the right side of a selection region.
android:textSize Size of the text.
android:textStyle Style (bold, italic, bolditalic) for the text.
android:typeface Typeface (normal, sans, serif, monospace) for the text.
android:width Makes the TextView be exactly this many pixels wide.
Viewの属性

メソッド (Method)

setText

public final void setText (int resid)
setText - TextView | Android Developers
public final void setText (int resid, TextView.BufferType type)
public final void setText (char[] text, int start, int len)
public final void setText (CharSequence text)
public void setText (CharSequence text, TextView.BufferType type)
TextView textView = (TextView)findViewById(R.id.Foo);
textView.setText("TEST");

append

public final void append (CharSequence text)
append - TextView | Android Developers

イベントリスナー

メソッド コールされるタイミング APIレベル
setOnClickListener ビューのクリック 1
setOnLongClickListener ビューの長押し
setOnCreateContextMenuListener コンテキスト メニューの生成
setOnFocusChangeListener フォーカスの変化
setOnKeyListener キーの押下
setOnTouchListener ビューのタッチ
addTextChangedListener テキストの変更
setOnEditorActionListener アクションの実行 3
setOnDragListener ドラッグ 11
setOnSystemUiVisibilityChangeListener システムバーの可視性の変化
setOnGenericMotionListener ビューのジェネリック モーション 12
Viewのイベント
Androidの情報サイトから、まとめて検索