Added in API level XE12
A special form of a BaseAdapter
.
Use this in combination with a CardScrollView
to implement horizontally scrolling views, also referred to as cards. This adapter binds (possibly dynamic) data to the CardScrollView
by retrieving the data (if needed) and converting each data item into a card. Each card visually represents a certain Object
item.
To be consistent with the Glass UI, create cards with the CardBuilder
class, which supports several content layouts. If you require more flexibility, you can create your own XML layouts or create views programmatically.
See Scrolling cards in activities for more information.
Inherent Constants | |
---|---|
From interface android.widget.Adapter | |
int | INGOREITEMVIEW_TYPE |
int | NO_SELECTION |
Public Constructors | |
---|---|
CardScrollAdapter() |
Public Methods | |
---|---|
abstract int | getCount() |
int | getHomePosition() |
abstract Object | getItem(int position) |
long | getItemId(int position) |
int | getItemViewType(int position) |
abstract int | getPosition(Object item) |
abstract View | getView(int position, View convertView, ViewGroup parent) |
int | getViewTypeCount() |
Inherited Methods | |
---|---|
From class android.widget.BaseAdapter | |
boolean | areAllItemsEnabled() |
View | getDropDownView(int arg0, View arg1, ViewGroup arg2) |
int | getItemViewType(int arg0) |
int | getViewTypeCount() |
boolean | hasStableIds() |
boolean | isEmpty() |
boolean | isEnabled(int arg0) |
void | notifyDataSetChanged() |
void | notifyDataSetInvalidated() |
void | registerDataSetObserver(DataSetObserver arg0) |
void | unregisterDataSetObserver(DataSetObserver arg0) |
From class java.lang.Object | |
Object | clone() |
boolean | equals(Object arg0) |
void | finalize() |
final Class<?> | getClass() |
int | hashCode() |
final void | notify() |
final void | notifyAll() |
String | toString() |
final void | wait() |
final void | wait(long arg0, int arg1) |
final void | wait(long arg0) |
From interface android.widget.Adapter | |
abstract int | getCount() |
abstract Object | getItem(int arg0) |
abstract long | getItemId(int arg0) |
abstract int | getItemViewType(int arg0) |
abstract View | getView(int arg0, View arg1, ViewGroup arg2) |
abstract int | getViewTypeCount() |
abstract boolean | hasStableIds() |
abstract boolean | isEmpty() |
abstract void | registerDataSetObserver(DataSetObserver arg0) |
abstract void | unregisterDataSetObserver(DataSetObserver arg0) |
From interface android.widget.ListAdapter | |
abstract boolean | areAllItemsEnabled() |
abstract boolean | isEnabled(int arg0) |
From interface android.widget.SpinnerAdapter | |
abstract View | getDropDownView(int arg0, View arg1, ViewGroup arg2) |
Added in API level XE12
Added in API level XE12
Returns the home position. The default implementation simply assumes position 0 is the home position, but the user can override this method to move the home position to a different card.
For example, the home position of the Glass timeline is the clock card, and other cards can be located both to the left and to the right of it.
Added in API level XE12
Added in API level XE12
The default implementation simply assigns the card’s position as row identifier and assumes this property holds even across data changes. When each data item has a truly unique row identifier, users can override this method to return the real row identifier and override hasStableIds()
to return true. By doing so, the card scroller is more likely to maintain its view on selected cards across data changes.
Added in API level XE16
Finds the position of the given item.
Parameters | |
---|---|
item | the item to find |
INVALID_POSITION
if the item cannot be foundAdded in API level XE12
The default implementation returns 0 to signal lack of recycling. Users can override this method (only called once when adapter is set) and getItemViewType(int)
to enable view recycling.
Portions of this page are reproduced from work created and shared by Google and used according to terms described in the Creative Commons 4.0 Attribution License.