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

ColumnCardView

public final class ColumnCardView
extends CardView

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ androidx.cardview.widget.CardView
           ↳ androidx.car.widget.ColumnCardView


A CardView whose width can be specified by the number of columns that it will span.

The ColumnCardView works similarly to a regular CardView, except that its layout_width attribute is always ignored. Instead, its width is automatically calculated based on a specified columnSpan attribute. Alternatively, a user can call setColumnSpan(int). If no column span is given, the ColumnCardView will have a default span value that it uses.

 <androidx.car.widget.ColumnCardView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     app:columnSpan="4" />
 

See also:

Summary

Inherited XML attributes

Inherited constants

Inherited fields

Public constructors

ColumnCardView(Context context)
ColumnCardView(Context context, AttributeSet attrs)
ColumnCardView(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

int getColumnSpan()

Returns the currently number of columns that this ColumnCardView spans.

void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void setColumnSpan(int columnSpan)

Sets the number of columns that this ColumnCardView will span.

Inherited methods

Public constructors

ColumnCardView

ColumnCardView (Context context)

Parameters
context Context

ColumnCardView

ColumnCardView (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

ColumnCardView

ColumnCardView (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

getColumnSpan

int getColumnSpan ()

Returns the currently number of columns that this ColumnCardView spans.

Returns
int The number of columns this ColumnCardView spans across.

onMeasure

void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)

Parameters
widthMeasureSpec int

heightMeasureSpec int

setColumnSpan

void setColumnSpan (int columnSpan)

Sets the number of columns that this ColumnCardView will span. The given span is ignored if it is less than 0 or greater than the number of columns that fit on screen.

Parameters
columnSpan int: The number of columns this ColumnCardView will span across.