Most visited

Recently visited

Added in API level 1

FocusFinder

public class FocusFinder
extends Object

java.lang.Object
   ↳ android.view.FocusFinder


该算法用于从当前具有焦点的视图中查找给定方向上的下一个可聚焦视图。

Summary

Public methods

View findNearestTouchable(ViewGroup root, int x, int y, int direction, int[] deltas)

查找指定视图的最近可触摸视图。

final View findNextFocus(ViewGroup root, View focused, int direction)

从目前关注的角度出发,找到下一个要关注根后代的视图。

View findNextFocusFromRect(ViewGroup root, Rect focusedRect, int direction)

找到下一个视图,以便在根的后代中关注焦点,从根的坐标中的特定矩形中搜索。

static FocusFinder getInstance()

获取此线程的焦点查找器。

Inherited methods

From class java.lang.Object

Public methods

findNearestTouchable

Added in API level 1
View findNearestTouchable (ViewGroup root, 
                int x, 
                int y, 
                int direction, 
                int[] deltas)

查找指定视图的最近可触摸视图。

Parameters
root ViewGroup: The root of the tree in which to search
x int: X coordinate from which to start the search
y int: Y coordinate from which to start the search
direction int: Direction to look
deltas int: Offset from the to the edge of the nearest view. Note that this array may already be populated with values.
Returns
View The nearest touchable view, or null if none exists.

findNextFocus

Added in API level 1
View findNextFocus (ViewGroup root, 
                View focused, 
                int direction)

从目前关注的角度出发,找到下一个要关注根后代的视图。

Parameters
root ViewGroup: Contains focused. Cannot be null.
focused View: Has focus now.
direction int: Direction to look.
Returns
View The next focusable view, or null if none exists.

findNextFocusFromRect

Added in API level 1
View findNextFocusFromRect (ViewGroup root, 
                Rect focusedRect, 
                int direction)

找到下一个视图,以便在根的后代中关注焦点,从根的坐标中的特定矩形中搜索。

Parameters
root ViewGroup: Contains focusedRect. Cannot be null.
focusedRect Rect: The starting point of the search.
direction int: Direction to look.
Returns
View The next focusable view, or null if none exists.

getInstance

Added in API level 1
FocusFinder getInstance ()

获取此线程的焦点查找器。

Returns
FocusFinder

Hooray!