belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
BaseCardView
public
class
BaseCardView
extends FrameLayout
java.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | android.widget.FrameLayout | |||
↳ | android.support.v17.leanback.widget.BaseCardView |
Known Direct Subclasses |
A card style layout that responds to certain state changes. It arranges its children in a vertical column, with different regions becoming visible at different times.
A BaseCardView will draw its children based on its type, the region
visibilities of the child types, and the state of the widget. A child may be
marked as belonging to one of three regions: main, info, or extra. The main
region is always visible, while the info and extra regions can be set to
display based on the activated or selected state of the View. The card states
are set by calling setActivated
and
setSelected
.
See BaseCardView.LayoutParams
for layout attributes.
Summary
Nested classes | |
---|---|
class |
BaseCardView.LayoutParams
Per-child layout information associated with BaseCardView. |
Constants | |
---|---|
int |
CARD_REGION_VISIBLE_ACTIVATED
Indicates that a card region is visible when the card is activated. |
int |
CARD_REGION_VISIBLE_ALWAYS
Indicates that a card region is always visible. |
int |
CARD_REGION_VISIBLE_SELECTED
Indicates that a card region is visible when the card is selected. |
int |
CARD_TYPE_INFO_OVER
A Card type with 2 layout areas: A main area which is always visible, and an info area that fades in over the main area when it is visible. |
int |
CARD_TYPE_INFO_UNDER
A Card type with 2 layout areas: A main area which is always visible, and an info area that appears below the main area. |
int |
CARD_TYPE_INFO_UNDER_WITH_EXTRA
A Card type with 3 layout areas: A main area which is always visible; an info area which will appear below the main area, and an extra area that only appears after a short delay. |
int |
CARD_TYPE_MAIN_ONLY
A simple card type with a single layout area. |
Inherited constants |
---|
From
class
android.view.ViewGroup
|
From
class
android.view.View
|
Inherited fields |
---|
From
class
android.view.View
|
Public constructors | |
---|---|
BaseCardView(Context context)
|
|
BaseCardView(Context context, AttributeSet attrs)
|
|
BaseCardView(Context context, AttributeSet attrs, int defStyleAttr)
|
Public methods | |
---|---|
BaseCardView.LayoutParams
|
generateLayoutParams(AttributeSet attrs)
|
int
|
getCardType()
Returns the type of this Card. |
int
|
getExtraVisibility()
This method was deprecated
in API level 25.1.0.
Extra view's visibility is controlled by |
int
|
getInfoVisibility()
Returns the visibility of the info region of the card. |
boolean
|
isSelectedAnimationDelayed()
Returns a boolean indicating if the selected animation will run immediately or be delayed the next time the card is Selected. |
void
|
setActivated(boolean activated)
Sets the Activated state of this Card. |
void
|
setCardType(int type)
Sets the type of this Card. |
void
|
setExtraVisibility(int visibility)
This method was deprecated
in API level 25.1.0.
Extra view's visibility is controlled by |
void
|
setInfoVisibility(int visibility)
Sets the visibility of the info region of the card. |
void
|
setSelected(boolean selected)
Sets the Selected state of this Card. |
void
|
setSelectedAnimationDelayed(boolean delay)
Sets a flag indicating if the Selected animation (if the selected card type implements one) should run immediately after the card is selected, or if it should be delayed. |
boolean
|
shouldDelayChildPressedState()
|
String
|
toString()
|
Protected methods | |
---|---|
boolean
|
checkLayoutParams(ViewGroup.LayoutParams p)
|
BaseCardView.LayoutParams
|
generateDefaultLayoutParams()
|
BaseCardView.LayoutParams
|
generateLayoutParams(ViewGroup.LayoutParams lp)
|
int[]
|
onCreateDrawableState(int extraSpace)
|
void
|
onDetachedFromWindow()
|
void
|
onLayout(boolean changed, int left, int top, int right, int bottom)
|
void
|
onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
Inherited methods | |
---|---|
From
class
android.widget.FrameLayout
| |
From
class
android.view.ViewGroup
| |
From
class
android.view.View
| |
From
class
java.lang.Object
| |
From
interface
android.view.ViewParent
| |
From
interface
android.view.ViewManager
| |
From
interface
android.graphics.drawable.Drawable.Callback
| |
From
interface
android.view.KeyEvent.Callback
| |
From
interface
android.view.accessibility.AccessibilityEventSource
|
Constants
CARD_REGION_VISIBLE_ACTIVATED
int CARD_REGION_VISIBLE_ACTIVATED
Indicates that a card region is visible when the card is activated.
Constant Value: 1 (0x00000001)
CARD_REGION_VISIBLE_ALWAYS
int CARD_REGION_VISIBLE_ALWAYS
Indicates that a card region is always visible.
Constant Value: 0 (0x00000000)
CARD_REGION_VISIBLE_SELECTED
int CARD_REGION_VISIBLE_SELECTED
Indicates that a card region is visible when the card is selected.
Constant Value: 2 (0x00000002)
CARD_TYPE_INFO_OVER
int CARD_TYPE_INFO_OVER
A Card type with 2 layout areas: A main area which is always visible, and an info area that fades in over the main area when it is visible. The card height will not change.
See also:
Constant Value: 1 (0x00000001)
CARD_TYPE_INFO_UNDER
int CARD_TYPE_INFO_UNDER
A Card type with 2 layout areas: A main area which is always visible, and an info area that appears below the main area. When the info area is visible the total card height will change.
See also:
Constant Value: 2 (0x00000002)
CARD_TYPE_INFO_UNDER_WITH_EXTRA
int CARD_TYPE_INFO_UNDER_WITH_EXTRA
A Card type with 3 layout areas: A main area which is always visible; an info area which will appear below the main area, and an extra area that only appears after a short delay. The info area appears below the main area, causing the total card height to change. The extra area animates in at the bottom of the card, shifting up the info view without affecting the card height.
See also:
Constant Value: 3 (0x00000003)
CARD_TYPE_MAIN_ONLY
int CARD_TYPE_MAIN_ONLY
A simple card type with a single layout area. This card type does not change its layout or size as it transitions between Activated/Not-Activated or Selected/Unselected states.
See also:
Constant Value: 0 (0x00000000)
Public constructors
BaseCardView
BaseCardView (Context context, AttributeSet attrs)
Parameters | |
---|---|
context |
Context |
attrs |
AttributeSet |
BaseCardView
BaseCardView (Context context, AttributeSet attrs, int defStyleAttr)
Parameters | |
---|---|
context |
Context |
attrs |
AttributeSet |
defStyleAttr |
int |
Public methods
generateLayoutParams
BaseCardView.LayoutParams generateLayoutParams (AttributeSet attrs)
Parameters | |
---|---|
attrs |
AttributeSet |
Returns | |
---|---|
BaseCardView.LayoutParams |
getCardType
int getCardType ()
Returns the type of this Card.
Returns | |
---|---|
int |
The type of this card. |
getExtraVisibility
int getExtraVisibility ()
This method was deprecated
in API level 25.1.0.
Extra view's visibility is controlled by getInfoVisibility()
Returns the visibility of the extra region of the card.
Returns | |
---|---|
int |
getInfoVisibility
int getInfoVisibility ()
Returns the visibility of the info region of the card.
Returns | |
---|---|
int |
isSelectedAnimationDelayed
boolean isSelectedAnimationDelayed ()
Returns a boolean indicating if the selected animation will run immediately or be delayed the next time the card is Selected.
Returns | |
---|---|
boolean |
true if this card is set to delay the selected animation the next time it is selected, or false if the selected animation will run immediately the next time the card is selected. |
setActivated
void setActivated (boolean activated)
Sets the Activated state of this Card. This can trigger changes in the card layout, resulting in views to become visible or hidden. A card is normally set to Activated state when its parent container (like a Row) receives focus, and then activates all of its children.
Parameters | |
---|---|
activated |
boolean : True if the card is ACTIVE, or false if INACTIVE. |
See also:
setCardType
void setCardType (int type)
Sets the type of this Card.
Parameters | |
---|---|
type |
int : The desired card type.
|
setExtraVisibility
void setExtraVisibility (int visibility)
This method was deprecated
in API level 25.1.0.
Extra view's visibility is controlled by setInfoVisibility(int)
Sets the visibility of the extra region of the card.
Parameters | |
---|---|
visibility |
int : The region visibility to use for the extra region. Must
be one of CARD_REGION_VISIBLE_ALWAYS ,
CARD_REGION_VISIBLE_SELECTED , or
CARD_REGION_VISIBLE_ACTIVATED . |
setInfoVisibility
void setInfoVisibility (int visibility)
Sets the visibility of the info region of the card.
Parameters | |
---|---|
visibility |
int : The region visibility to use for the info region. Must
be one of CARD_REGION_VISIBLE_ALWAYS ,
CARD_REGION_VISIBLE_SELECTED , or
CARD_REGION_VISIBLE_ACTIVATED .
|
setSelected
void setSelected (boolean selected)
Sets the Selected state of this Card. This can trigger changes in the card layout, resulting in views to become visible or hidden. A card is normally set to Selected state when it receives input focus.
Parameters | |
---|---|
selected |
boolean : True if the card is Selected, or false otherwise. |
See also:
setSelectedAnimationDelayed
void setSelectedAnimationDelayed (boolean delay)
Sets a flag indicating if the Selected animation (if the selected card type implements one) should run immediately after the card is selected, or if it should be delayed. The default behavior is to delay this animation. This is a one-shot override. If set to false, after the card is selected and the selected animation is triggered, this flag is automatically reset to true. This is useful when you want to change the default behavior, and have the selected animation run immediately. One such case could be when focus moves from one row to the other, when instead of delaying the selected animation until the user pauses on a card, it may be desirable to trigger the animation for that card immediately.
Parameters | |
---|---|
delay |
boolean : True (default) if the selected animation should be delayed
after the card is selected, or false if the animation should
run immediately the next time the card is Selected.
|
shouldDelayChildPressedState
boolean shouldDelayChildPressedState ()
Returns | |
---|---|
boolean |
toString
String toString ()
Returns | |
---|---|
String |
Protected methods
checkLayoutParams
boolean checkLayoutParams (ViewGroup.LayoutParams p)
Parameters | |
---|---|
p |
ViewGroup.LayoutParams |
Returns | |
---|---|
boolean |
generateDefaultLayoutParams
BaseCardView.LayoutParams generateDefaultLayoutParams ()
Returns | |
---|---|
BaseCardView.LayoutParams |
generateLayoutParams
BaseCardView.LayoutParams generateLayoutParams (ViewGroup.LayoutParams lp)
Parameters | |
---|---|
lp |
ViewGroup.LayoutParams |
Returns | |
---|---|
BaseCardView.LayoutParams |
onCreateDrawableState
int[] onCreateDrawableState (int extraSpace)
Parameters | |
---|---|
extraSpace |
int |
Returns | |
---|---|
int[] |
onDetachedFromWindow
void onDetachedFromWindow ()
onLayout
void onLayout (boolean changed, int left, int top, int right, int bottom)
Parameters | |
---|---|
changed |
boolean |
left |
int |
top |
int |
right |
int |
bottom |
int |
onMeasure
void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
Parameters | |
---|---|
widthMeasureSpec |
int |
heightMeasureSpec |
int |
Interfaces
- BaseGridView.OnKeyInterceptListener
- BaseGridView.OnMotionInterceptListener
- BaseGridView.OnTouchInterceptListener
- BaseGridView.OnUnhandledKeyListener
- BaseOnItemViewClickedListener
- BaseOnItemViewSelectedListener
- BrowseFrameLayout.OnChildFocusListener
- BrowseFrameLayout.OnFocusSearchListener
- FacetProvider
- FacetProviderAdapter
- FocusHighlight
- FragmentAnimationProvider
- ImeKeyMonitor
- ImeKeyMonitor.ImeKeyListener
- MultiActionsProvider
- OnActionClickedListener
- OnChildLaidOutListener
- OnChildSelectedListener
- OnItemViewClickedListener
- OnItemViewSelectedListener
- PlaybackSeekUi
- SearchBar.SearchBarListener
- SearchBar.SearchBarPermissionListener
- SearchEditText.OnKeyboardDismissListener
- SpeechRecognitionCallback
- TitleViewAdapter.Provider
- ViewHolderTask
Classes
- AbstractDetailsDescriptionPresenter
- AbstractDetailsDescriptionPresenter.ViewHolder
- AbstractMediaItemPresenter
- AbstractMediaItemPresenter.ViewHolder
- AbstractMediaListHeaderPresenter
- AbstractMediaListHeaderPresenter.ViewHolder
- Action
- ArrayObjectAdapter
- BaseCardView
- BaseCardView.LayoutParams
- BaseGridView
- BrowseFrameLayout
- ClassPresenterSelector
- ControlButtonPresenterSelector
- CursorObjectAdapter
- DetailsOverviewLogoPresenter
- DetailsOverviewLogoPresenter.ViewHolder
- DetailsOverviewRow
- DetailsOverviewRow.Listener
- DetailsOverviewRowPresenter
- DetailsOverviewRowPresenter.ViewHolder
- DetailsParallax
- DiffCallback
- DividerPresenter
- DividerRow
- FocusHighlightHelper
- FullWidthDetailsOverviewRowPresenter
- FullWidthDetailsOverviewRowPresenter.Listener
- FullWidthDetailsOverviewRowPresenter.ViewHolder
- FullWidthDetailsOverviewRowPresenter.ViewHolder.DetailsOverviewRowListener
- FullWidthDetailsOverviewSharedElementHelper
- GuidanceStylist
- GuidanceStylist.Guidance
- GuidedAction
- GuidedAction.Builder
- GuidedAction.BuilderBase
- GuidedActionDiffCallback
- GuidedActionEditText
- GuidedActionsStylist
- GuidedActionsStylist.ViewHolder
- GuidedDatePickerAction
- GuidedDatePickerAction.Builder
- GuidedDatePickerAction.BuilderBase
- HeaderItem
- HorizontalGridView
- HorizontalHoverCardSwitcher
- ImageCardView
- ItemAlignmentFacet
- ItemAlignmentFacet.ItemAlignmentDef
- ItemBridgeAdapter
- ItemBridgeAdapter.AdapterListener
- ItemBridgeAdapter.ViewHolder
- ItemBridgeAdapter.Wrapper
- ItemBridgeAdapterShadowOverlayWrapper
- ListRow
- ListRowHoverCardView
- ListRowPresenter
- ListRowPresenter.SelectItemViewHolderTask
- ListRowPresenter.ViewHolder
- ListRowView
- MultiActionsProvider.MultiAction
- ObjectAdapter
- ObjectAdapter.DataObserver
- OnChildViewHolderSelectedListener
- PageRow
- Parallax
- Parallax.FloatProperty
- Parallax.IntProperty
- Parallax.PropertyMarkerValue
- ParallaxEffect
- ParallaxTarget
- ParallaxTarget.DirectPropertyTarget
- ParallaxTarget.PropertyValuesHolderTarget
- PlaybackControlsRow
- PlaybackControlsRow.ClosedCaptioningAction
- PlaybackControlsRow.FastForwardAction
- PlaybackControlsRow.HighQualityAction
- PlaybackControlsRow.MoreActions
- PlaybackControlsRow.MultiAction
- PlaybackControlsRow.OnPlaybackProgressCallback
- PlaybackControlsRow.PictureInPictureAction
- PlaybackControlsRow.PlayPauseAction
- PlaybackControlsRow.RepeatAction
- PlaybackControlsRow.RewindAction
- PlaybackControlsRow.ShuffleAction
- PlaybackControlsRow.SkipNextAction
- PlaybackControlsRow.SkipPreviousAction
- PlaybackControlsRow.ThumbsAction
- PlaybackControlsRow.ThumbsDownAction
- PlaybackControlsRow.ThumbsUpAction
- PlaybackControlsRowPresenter
- PlaybackControlsRowPresenter.ViewHolder
- PlaybackRowPresenter
- PlaybackRowPresenter.ViewHolder
- PlaybackSeekDataProvider
- PlaybackSeekDataProvider.ResultCallback
- PlaybackSeekUi.Client
- PlaybackTransportRowPresenter
- PlaybackTransportRowPresenter.ViewHolder
- Presenter
- Presenter.ViewHolder
- Presenter.ViewHolderTask
- PresenterSelector
- PresenterSwitcher
- RecyclerViewParallax
- RecyclerViewParallax.ChildPositionProperty
- Row
- RowHeaderPresenter
- RowHeaderPresenter.ViewHolder
- RowHeaderView
- RowPresenter
- RowPresenter.ViewHolder
- SearchBar
- SearchEditText
- SearchOrbView
- SearchOrbView.Colors
- SectionRow
- ShadowOverlayContainer
- ShadowOverlayHelper
- ShadowOverlayHelper.Builder
- ShadowOverlayHelper.Options
- SinglePresenterSelector
- SparseArrayObjectAdapter
- SpeechOrbView
- TitleHelper
- TitleView
- TitleViewAdapter
- VerticalGridPresenter
- VerticalGridPresenter.ViewHolder
- VerticalGridView
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.