Google 致力于为黑人社区推动种族平等。查看具体举措

ArrayObjectAdapter

open class ArrayObjectAdapter : ObjectAdapter
kotlin.Any
   ↳ androidx.leanback.widget.ObjectAdapter
   ↳ androidx.leanback.widget.ArrayObjectAdapter

An ObjectAdapter implemented with an ArrayList.

Summary

Inherited constants
Public constructors
<init>(presenterSelector: PresenterSelector!)

Constructs an adapter with the given PresenterSelector.

<init>(presenter: Presenter!)

Constructs an adapter that uses the given Presenter for all items.

Constructs an adapter.

Public methods
open Unit
add(item: Any!)

Adds an item to the end of the adapter.

open Unit
add(index: Int, item: Any!)

Inserts an item into this adapter at the specified index.

open Unit
addAll(index: Int, items: MutableCollection<Any?>!)

Adds the objects in the given collection to the adapter, starting at the given index.

open Unit

Removes all items from this adapter, leaving it empty.

open Any!
get(index: Int)

open Int
indexOf(item: Any!)

Returns the index for the first occurrence of item in the adapter, or -1 if not found.

open Boolean

open Unit
move(fromPosition: Int, toPosition: Int)

Moved the item at fromPosition to toPosition.

open Unit
notifyArrayItemRangeChanged(positionStart: Int, itemCount: Int)

Notify that the content of a range of items changed.

open Boolean
remove(item: Any!)

Removes the first occurrence of the given item from the adapter.

open Int
removeItems(position: Int, count: Int)

Removes a range of items from the adapter.

open Unit
replace(position: Int, item: Any!)

Replaces item at position with a new item and calls notifyItemRangeChanged() at the given position.

open Unit
setItems(itemList: MutableList<Any?>!, callback: DiffCallback<Any!>!)

Set a new item list to adapter.

open Int

open MutableList<E>!

Gets a read-only view of the list of object of this ArrayObjectAdapter.

Inherited functions

Public constructors

<init>

ArrayObjectAdapter(presenterSelector: PresenterSelector!)

Constructs an adapter with the given PresenterSelector.

<init>

ArrayObjectAdapter(presenter: Presenter!)

Constructs an adapter that uses the given Presenter for all items.

<init>

ArrayObjectAdapter()

Constructs an adapter.

Public methods

add

open fun add(item: Any!): Unit

Adds an item to the end of the adapter.

Parameters
item Any!: The item to add to the end of the adapter.

add

open fun add(
    index: Int,