Most visited

Recently visited

Added in API level 21

CursorAnchorInfo.Builder

public static final class CursorAnchorInfo.Builder
extends Object

java.lang.Object
    android.view.inputmethod.CursorAnchorInfo.Builder


建设者为CursorAnchorInfo 这个类不是为线程安全的。

摘要(Summary)

Public constructors

CursorAnchorInfo.Builder()

公共方法(Public methods)

CursorAnchorInfo.Builder addCharacterBounds(int index, float left, float top, float right, float bottom, int flags)

添加用索引指定的字符的边界框。

CursorAnchorInfo build()
void reset()

重置内部状态,以便可以重新使用此实例来构建另一个 CursorAnchorInfo实例。

CursorAnchorInfo.Builder setComposingText(int composingTextStart, CharSequence composingText)

设置撰写文本的文本范围。

CursorAnchorInfo.Builder setInsertionMarkerLocation(float horizontalPosition, float lineTop, float lineBaseline, float lineBottom, int flags)

将文本插入点(零宽度光标)的位置设置为本地坐标中的矩形。

CursorAnchorInfo.Builder setMatrix(Matrix matrix)

设置将局部坐标转换为屏幕坐标的矩阵。

CursorAnchorInfo.Builder setSelectionRange(int newStart, int newEnd)

设置选择的文本范围。

继承方法(Inherited methods)

From class java.lang.Object

Public constructors

CursorAnchorInfo.Builder

Added in API level 21
CursorAnchorInfo.Builder ()

公共方法(Public methods)

addCharacterBounds

Added in API level 21
CursorAnchorInfo.Builder addCharacterBounds (int index, 
                float left, 
                float top, 
                float right, 
                float bottom, 
                int flags)

添加用索引指定的字符的边界框。

参数(Parameters)
index int: index of the character in Java chars units. Must be specified in ascending order across successive calls.
left float: x coordinate of the left edge of the character in local coordinates.
top float: y coordinate of the top edge of the character in local coordinates.
right float: x coordinate of the right edge of the character in local coordinates.
bottom float: y coordinate of the bottom edge of the character in local coordinates.
flags int: flags for this character bounds. See FLAG_HAS_VISIBLE_REGION, FLAG_HAS_INVISIBLE_REGION and FLAG_IS_RTL. These flags must be specified when necessary.
返回(Returns)
CursorAnchorInfo.Builder
抛出异常(Throws)
IllegalArgumentException If the index is a negative value, or not greater than all of the previously called indices.

build

Added in API level 21
CursorAnchorInfo build ()

返回(Returns)
CursorAnchorInfo CursorAnchorInfo using parameters in this CursorAnchorInfo.Builder.
抛出异常(Throws)
IllegalArgumentException if one or more positional parameters are specified but the coordinate transformation matrix is not provided via setMatrix(Matrix).

reset

Added in API level 21
void reset ()

重置内部状态,以便可以重新使用此实例来构建另一个 CursorAnchorInfo实例。

setComposingText

Added in API level 21
CursorAnchorInfo.Builder setComposingText (int composingTextStart, 
                CharSequence composingText)

设置撰写文本的文本范围。 如果没有撰写文本,则可以跳过这种调用。

参数(Parameters)
composingTextStart int: index where the composing text starts.
composingText CharSequence: the entire composing text.
返回(Returns)
CursorAnchorInfo.Builder

setInsertionMarkerLocation

Added in API level 21
CursorAnchorInfo.Builder setInsertionMarkerLocation (float horizontalPosition, 
                float lineTop, 
                float lineBaseline, 
                float lineBottom, 
                int flags)

将文本插入点(零宽度光标)的位置设置为本地坐标中的矩形。 如果没有文本插入点,则可以跳过这种调用; 但是,如果存在插入点,编辑者必须调用此方法。

参数(Parameters)
horizontalPosition float: horizontal position of the insertion marker, in the local coordinates that will be transformed with the transformation matrix when rendered on the screen. This should be calculated or compatible with getPrimaryHorizontal(int).
lineTop float: vertical position of the insertion marker, in the local coordinates that will be transformed with the transformation matrix when rendered on the screen. This should be calculated or compatible with getLineTop(int).
lineBaseline float: vertical position of the insertion marker, in the local coordinates that will be transformed with the transformation matrix when rendered on the screen. This should be calculated or compatible with getLineBaseline(int).
lineBottom float: vertical position of the insertion marker, in the local coordinates that will be transformed with the transformation matrix when rendered on the screen. This should be calculated or compatible with getLineBottom(int).
flags int: flags of the insertion marker. See FLAG_HAS_VISIBLE_REGION for example.
返回(Returns)
CursorAnchorInfo.Builder

setMatrix

Added in API level 21
CursorAnchorInfo.Builder setMatrix (Matrix matrix)

设置将局部坐标转换为屏幕坐标的矩阵。

参数(Parameters)
matrix Matrix: transformation matrix from local coordinates into screen coordinates. null is interpreted as an identity matrix.
返回(Returns)
CursorAnchorInfo.Builder

setSelectionRange

Added in API level 21
CursorAnchorInfo.Builder setSelectionRange (int newStart, 
                int newEnd)

设置选择的文本范围。 如果没有选择,调用它可以跳过。

参数(Parameters)
newStart int
newEnd int
返回(Returns)
CursorAnchorInfo.Builder

Hooray!