Selection
open class Selection
kotlin.Any | |
↳ | android.text.Selection |
Utility class for manipulating cursors and selections in CharSequences. A cursor is a selection where the start and end are at the same offset.
Summary
Public methods | |
---|---|
open static Boolean |
extendDown(text: Spannable!, layout: Layout!) Move the selection end to the buffer offset physically below the current selection end. |
open static Boolean |
extendLeft(text: Spannable!, layout: Layout!) Move the selection end to the buffer offset physically to the left of the current selection end. |
open static Boolean |
extendRight(text: Spannable!, layout: Layout!) Move the selection end to the buffer offset physically to the right of the current selection end. |
static Unit |
extendSelection(text: Spannable!, index: Int) Move the selection edge to offset |
open static Boolean |
extendToLeftEdge(text: Spannable!, layout: Layout!) |
open static Boolean |
extendToParagraphEnd(text: Spannable) Extend the selection to the closest paragraph end offset. |
open static Boolean |
extendToParagraphStart(text: Spannable) Extend the selection to the closest paragraph start offset. |
open static Boolean |
extendToRightEdge(text: Spannable!, layout: Layout!) |
open static Boolean |
Move the selection end to the buffer offset physically above the current selection end. |
static Int |
getSelectionEnd(text: CharSequence!) Return the offset of the selection edge or cursor, or -1 if there is no selection or cursor. |
static Int |
getSelectionStart(text: CharSequence!) Return the offset of the selection anchor or cursor, or -1 if there is no selection or cursor. |
open static Boolean |
Move the cursor to the buffer offset physically below the current offset, to the end of the buffer if it is on the bottom line but not at the end, or return false if the cursor is already at the end of the buffer. |
open static Boolean |
Move the cursor to the buffer offset physically to the left of the current offset, or return false if the cursor is already at the left edge of the line and there is not another line to move it to. |
open static Boolean |
Move the cursor to the buffer offset physically to the right of the current offset, or return false if the cursor is already at at the right edge of the line and there is not another line to move it to. |
open static Boolean |
moveToLeftEdge(text: Spannable!, layout: Layout!) |
open static Boolean |
moveToParagraphEnd(text: Spannable, layout: Layout) Move the cursor to the closest paragraph end offset. |
open static Boolean |
moveToParagraphStart(text: Spannable, layout: Layout) Move the cusrot to the closest paragraph start offset. |
open static Boolean |
moveToRightEdge(text: Spannable!, layout: Layout!) |
open static Boolean |
Move the cursor to the buffer offset physically above the current offset, to the beginning if it is on the top line but not at the start, or return false if the cursor is already on the top line. |
static Unit |
removeSelection(text: Spannable!) Remove the selection or cursor, if any, from the text. |
static Unit |
Select the entire text. |
open static Unit |
setSelection(text: Spannable!, start: Int, stop: Int) Set the selection anchor to |
static Unit |
setSelection(text: Spannable!, index: Int) Move the cursor to offset |
Properties | |
---|---|
static Any! | |
static Any! |
Public methods
extendDown
open static fun extendDown(
text: Spannable!,
layout: Layout!
): Boolean
Move the selection end to the buffer offset physically below the current selection end.
extendLeft
open static fun extendLeft(
text: Spannable!,
layout: Layout!
): Boolean
Move the selection end to the buffer offset physically to the left of the current selection end.
extendRight
open static fun extendRight(
text: Spannable!,
layout: Layout!
): Boolean
Move the selection end to the buffer offset physically to the right of the current selection end.
extendSelection
static fun extendSelection(
text: Spannable!,
index: Int
): Unit
Move the selection edge to offset index
.
extendToLeftEdge
open static fun extendToLeftEdge(
text: Spannable!,
layout: Layout!
): Boolean
extendToParagraphEnd
open static fun extendToParagraphEnd(text: Spannable): Boolean
Extend the selection to the closest paragraph end offset.
Parameters | |
---|---|
text |
Spannable: the spannable text This value cannot be null . |
Return | |
---|---|
Boolean |
true if the selection is extended, otherwise false |
extendToParagraphStart
open static fun extendToParagraphStart(text: Spannable): Boolean
Extend the selection to the closest paragraph start offset.
Parameters | |
---|---|
text |
Spannable: the spannable text This value cannot be null . |
Return | |
---|---|
Boolean |
true if the selection is extended, otherwise false |
extendToRightEdge
open static fun extendToRightEdge(
text: Spannable!,
layout: Layout!
): Boolean
extendUp
open static fun extendUp(
text: Spannable!,
layout: Layout!
): Boolean
Move the selection end to the buffer offset physically above the current selection end.
getSelectionEnd
static fun getSelectionEnd(text: CharSequence!): Int
Return the offset of the selection edge or cursor, or -1 if there is no selection or cursor.
getSelectionStart
static fun getSelectionStart(text: CharSequence!): Int
Return the offset of the selection anchor or cursor, or -1 if there is no selection or cursor.
moveDown
open static fun moveDown(
text: Spannable!,
layout: Layout!
): Boolean
Move the cursor to the buffer offset physically below the current offset, to the end of the buffer if it is on the bottom line but not at the end, or return false if the cursor is already at the end of the buffer.
moveLeft
open static fun moveLeft(
text: Spannable!,
layout: Layout!
): Boolean
Move the cursor to the buffer offset physically to the left of the current offset, or return false if the cursor is already at the left edge of the line and there is not another line to move it to.
moveRight
open static fun moveRight(
text: Spannable!,
layout: Layout!
): Boolean
Move the cursor to the buffer offset physically to the right of the current offset, or return false if the cursor is already at at the right edge of the line and there is not another line to move it to.
moveToLeftEdge
open static fun moveToLeftEdge(
text: Spannable!,
layout: Layout!
): Boolean
moveToParagraphEnd
open static fun moveToParagraphEnd(
text: Spannable,
layout: Layout
): Boolean
Move the cursor to the closest paragraph end offset.
Parameters | |
---|---|
text |
Spannable: the spannable text This value cannot be null . |
layout |
Layout: layout to be used for drawing. This value cannot be null . |
Return | |
---|---|
Boolean |
true if the cursor is moved, otherwise false. |
moveToParagraphStart
open static fun moveToParagraphStart(
text: Spannable,
layout: Layout
): Boolean
Move the cusrot to the closest paragraph start offset.
Parameters | |
---|---|
text |
Spannable: the spannable text This value cannot be null . |
layout |
Layout: layout to be used for drawing. This value cannot be null . |
Return | |
---|---|
Boolean |
true if the cursor is moved, otherwise false. |
moveToRightEdge
open static fun moveToRightEdge(
text: Spannable!,
layout: Layout!
): Boolean
moveUp
open static fun moveUp(
text: Spannable!,
layout: Layout!
): Boolean
Move the cursor to the buffer offset physically above the current offset, to the beginning if it is on the top line but not at the start, or return false if the cursor is already on the top line.
removeSelection
static fun removeSelection(text: Spannable!): Unit
Remove the selection or cursor, if any, from the text.
setSelection
open static fun setSelection(
text: Spannable!,
start: Int,
stop: Int
): Unit
Set the selection anchor to start
and the selection edge to stop
.
setSelection
static fun setSelection(
text: Spannable!,
index: Int
): Unit
Move the cursor to offset index
.