Most visited

Recently visited

Added in API level 1

TransformationMethod

public interface TransformationMethod

android.text.method.TransformationMethod
Known Indirect Subclasses


TextView使用TransformationMethods来执行诸如用点替换密码字符或保持换行符不会在单行文本字段中引起换行符的操作。

Summary

Public methods

abstract CharSequence getTransformation(CharSequence source, View view)

返回一个CharSequence,它是源文本的转换 - 例如,用密码字段中的一个点替换每个字符。

abstract void onFocusChanged(View view, CharSequence sourceText, boolean focused, int direction, Rect previouslyFocusedRect)

当使用此TransformationMethod的TextView获得或失去焦点时,将调用此方法。

Public methods

getTransformation

Added in API level 1
CharSequence getTransformation (CharSequence source, 
                View view)

返回一个CharSequence,它是源文本的转换 - 例如,用密码字段中的一个点替换每个字符。 请注意,返回的文本必须与源文本的长度完全相同,并且如果源文本是可编辑的,则返回的文本必须动态镜像,而不是一次性复制。

Parameters
source CharSequence
view View
Returns
CharSequence

onFocusChanged

Added in API level 1
void onFocusChanged (View view, 
                CharSequence sourceText, 
                boolean focused, 
                int direction, 
                Rect previouslyFocusedRect)

当使用此TransformationMethod的TextView获得或失去焦点时,将调用此方法。

Parameters
view View
sourceText CharSequence
focused boolean
direction int
previouslyFocusedRect Rect

Hooray!