Added in API level 1

AdapterView


abstract class AdapterView<T : Adapter!> : ViewGroup
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.AdapterView

An AdapterView is a view whose children are determined by an Adapter.

See ListView, GridView, Spinner and Gallery for commonly used subclasses of AdapterView.

Summary

Nested classes
open

Extra menu information provided to the android.view.View.OnCreateContextMenuListener#onCreateContextMenu(ContextMenu, View, ContextMenuInfo) callback when a context menu is brought up for this AdapterView.

abstract

Interface definition for a callback to be invoked when an item in this AdapterView has been clicked.

abstract

Interface definition for a callback to be invoked when an item in this view has been clicked and held.

abstract

Interface definition for a callback to be invoked when an item in this view has been selected.

Inherited XML attributes
Constants
static Int

Represents an invalid position.

static Long

Represents an empty or invalid row id

static Int

The item view type returned by Adapter.getItemViewType(int) when the item is a header or footer.

static Int

The item view type returned by Adapter.getItemViewType(int) when the adapter does not want the item's view recycled.

Inherited constants
Public constructors
AdapterView(context: Context!)

AdapterView(context: Context!, attrs: AttributeSet!)

AdapterView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

AdapterView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open Unit
addView(child: View!)

This method is not supported and throws an UnsupportedOperationException when called.

open Unit
addView(child: View!, params: ViewGroup.LayoutParams!)

This method is not supported and throws an UnsupportedOperationException when called.

open Unit
addView(child: View!, index: Int)

This method is not supported and throws an UnsupportedOperationException when called.

open Unit
addView(child: View!, index: Int, params: ViewGroup.LayoutParams!)

This method is not supported and throws an UnsupportedOperationException when called.

open CharSequence!

abstract T

Returns the adapter currently associated with this widget.

open Int

open View!

When the current adapter is empty, the AdapterView can display a special view called the empty view.

open Int

Returns the position within the adapter's data set for the first item displayed on screen.

open Any!

Gets the data associated with the specified position in the list.

open Long

open Int

Returns the position within the adapter's data set for the last item displayed on screen.

AdapterView.OnItemClickListener?

AdapterView.OnItemLongClickListener!

AdapterView.OnItemSelectedListener?

open Int

Returns the position within the adapter's data set for the view, where view is a an adapter item or a descendant of an adapter item.

open Any!

open Long

open Int

Return the position of the currently selected item within the adapter's data set

abstract View!

open Unit

Populates a ViewStructure to fullfil an autofill request.

open Boolean
performItemClick(view: View!, position: Int, id: Long)

Call the OnItemClickListener, if it is defined.

open Unit

This method is not supported and throws an UnsupportedOperationException when called.

open Unit
removeView(child: View!)

This method is not supported and throws an UnsupportedOperationException when called.

open Unit
removeViewAt(index: Int)

This method is not supported and throws an UnsupportedOperationException when called.

abstract Unit
setAdapter(adapter: T)

Sets the adapter that provides the data and the views to represent the data in this widget.

open Unit
setEmptyView(emptyView: View!)

Sets the view to show if the adapter is empty

open Unit
setFocusable(focusable: Int)

Sets whether this view can receive focus.

open Unit

open Unit

open Unit

Register a callback to be invoked when an item in this AdapterView has been clicked.

open Unit

Register a callback to be invoked when an item in this AdapterView has been clicked and held

open Unit

Register a callback to be invoked when an item in this AdapterView has been selected.

abstract Unit
setSelection(position: Int)

Sets the currently selected item.

Protected methods
open Boolean

open Unit

Override to prevent thawing of any views created by the adapter.

open Unit

Override to prevent freezing of any views created by the adapter.

open Unit

open Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)

Inherited functions