belongs to Maven artifact androidx.car:car:1.0.0-alpha1

SubheaderListItem

public class SubheaderListItem
extends ListItem<SubheaderListItem.ViewHolder>

java.lang.Object
   ↳ androidx.car.widget.ListItem<androidx.car.widget.SubheaderListItem.ViewHolder>
     ↳ androidx.car.widget.SubheaderListItem


Class to build a sub-header list item.

A sub-header list item consists of a one-line text. Its margin can be adjusted to match the rest of ListItem through setTextStartMarginType(int).

Summary

Nested classes

@interface SubheaderListItem.TextStartMarginType

 

class SubheaderListItem.ViewHolder

Holds views of SubHeaderListItem. 

Constants

int TEXT_START_MARGIN_TYPE_LARGE

Sets start margin of text the same as TextListItem.setPrimaryActionIcon(int, boolean) with useLargeIcon set to true.

int TEXT_START_MARGIN_TYPE_NONE

Sets start margin of text the same as TextListItem.setPrimaryActionNoIcon().

int TEXT_START_MARGIN_TYPE_SMALL

Sets start margin of text the same as TextListItem.setPrimaryActionIcon(int, boolean) with useLargeIcon set to false.

Public constructors

SubheaderListItem(Context context, String text)

Public methods

static SubheaderListItem.ViewHolder createViewHolder(View itemView)

Creates a SubheaderListItem.ViewHolder.

int getViewType()

Used by ListItemAdapter to choose layout to inflate for view holder.

void setText(String text)

Sets the text to be displayed.

void setTextStartMarginType(int type)

Sets the start margin of text.

Protected methods

void onBind(SubheaderListItem.ViewHolder viewHolder)

Applies ViewBinders to adjust view layout params.

void resolveDirtyState()

Calculates layout params for views in SubheaderListItem.ViewHolder.

Inherited methods

Constants

TEXT_START_MARGIN_TYPE_LARGE

int TEXT_START_MARGIN_TYPE_LARGE

Sets start margin of text the same as TextListItem.setPrimaryActionIcon(int, boolean) with useLargeIcon set to true.

Constant Value: 2 (0x00000002)

TEXT_START_MARGIN_TYPE_NONE

int TEXT_START_MARGIN_TYPE_NONE

Sets start margin of text the same as TextListItem.setPrimaryActionNoIcon().

Constant Value: 0 (0x00000000)

TEXT_START_MARGIN_TYPE_SMALL

int TEXT_START_MARGIN_TYPE_SMALL

Sets start margin of text the same as TextListItem.setPrimaryActionIcon(int, boolean) with useLargeIcon set to false.

Constant Value: 1 (0x00000001)

Public constructors

SubheaderListItem

SubheaderListItem (Context context, 
                String text)

Parameters
context Context

text String

Public methods

createViewHolder

SubheaderListItem.ViewHolder createViewHolder (View itemView)

Creates a SubheaderListItem.ViewHolder.

Parameters
itemView View

Returns
SubheaderListItem.ViewHolder

getViewType

int getViewType ()

Used by ListItemAdapter to choose layout to inflate for view holder.

Returns
int type of this ListItem.

setText

void setText (String text)

Sets the text to be displayed.

Parameters
text String

setTextStartMarginType

void setTextStartMarginType (int type)

Sets the start margin of text. Defaults to TEXT_START_MARGIN_TYPE_NONE.

Parameters
type int

Protected methods

onBind

void onBind (SubheaderListItem.ViewHolder viewHolder)

Applies ViewBinders to adjust view layout params.

Parameters
viewHolder SubheaderListItem.ViewHolder

resolveDirtyState

void resolveDirtyState ()

Calculates layout params for views in SubheaderListItem.ViewHolder.