FocusDelegate
public
abstract
class
FocusDelegate
extends Object
java.lang.Object | |
↳ | androidx.recyclerview.selection.FocusDelegate<K> |
Override methods in this class to provide application specific behaviors related to focusing item.
Summary
Public constructors | |
---|---|
FocusDelegate()
|
Public methods | |
---|---|
abstract
void
|
clearFocus()
If the environment supports focus and something is focused, unfocus it. |
abstract
void
|
focusItem(ItemDetails<K> item)
If environment supports focus, focus |
abstract
int
|
getFocusedPosition()
Returns the position of the currently focused item, or
|
abstract
boolean
|
hasFocusedItem()
|
Inherited methods | |
---|---|
Public constructors
FocusDelegate
public FocusDelegate ()
Public methods
clearFocus
public abstract void clearFocus ()
If the environment supports focus and something is focused, unfocus it.
focusItem
public abstract void focusItem (ItemDetails<K> item)
If environment supports focus, focus item
.
Parameters | |
---|---|
item |
ItemDetails |
getFocusedPosition
public abstract int getFocusedPosition ()
Returns the position of the currently focused item, or
RecyclerView.NO_POSITION
if nothing is focused.
You must implement this feature if you intend your app to work well with mouse and keyboard. Selection ranges are inferred from focused item when there is no explicit last-selected item.
You can manage and advance focus using keyboard arrows, reflecting this state visibly in the view item. Use can then press shift, then click another item with their mouse to select all items between the focused item and the clicked item.
Returns | |
---|---|
int |
the position of the currently focused item,
or RecyclerView#NO_POSITION if none.
|
hasFocusedItem
public abstract boolean hasFocusedItem ()
Returns | |
---|---|
boolean |
true if there is a focused item. |