VerticalGridView


public class VerticalGridView extends BaseGridView


A android.view.ViewGroup that shows items in a vertically scrolling list. The items come from the RecyclerView.Adapter associated with this view.

RecyclerView.Adapter can optionally implement FacetProviderAdapter which provides FacetProvider for a given view type; RecyclerView.ViewHolder can also implement FacetProvider. Facet from ViewHolder has a higher priority than the one from FacetProviderAdapter associated with viewType. Supported optional facets are:

  1. ItemAlignmentFacet When this facet is provided by ViewHolder or FacetProviderAdapter, it will override the item alignment settings set on VerticalGridView. This facet also allows multiple alignment positions within one ViewHolder.

Summary

Public constructors

VerticalGridView(
    @NonNull Context context,
    @Nullable AttributeSet attrs,
    int defStyle
)

Public methods

void
setColumnWidth(int width)

Sets the column width.

void
setNumColumns(int numColumns)

Sets the number of columns.

Protected methods

void

Inherited Constants

From androidx.leanback.widget.BaseGridView
static final float

Value indicates that percent is not used.

static final int

Save on screen views plus save off screen child views without any limitation.

static final int

Save on screen views plus save off screen child views states up to getSaveChildrenLimitNumber.

static final int

Dont save states of any child views.

static final int

Only save on screen child views, the states are lost when they become off screen.

static final int

The first item and last item are aligned with the two edges of the viewport.

static final int

The last item is aligned with the high edge of the viewport when navigating to the end of list.

static final int

The first item is aligned with the low edge of the viewport.

static final int

The focused item always stays in a key line location.

static final float

Value indicates that percent is not used.

From androidx.recyclerview.widget.RecyclerView
static final int
static final int
static final long
NO_ID = -1
static final int
static final int

The RecyclerView is currently being dragged by outside input such as user touch input.

static final int

The RecyclerView is not currently scrolling.

static final int

The RecyclerView is currently animating to a final position while not under outside control.

static final int

Constant for use with setScrollingTouchSlop.

static final int

Constant for use with setScrollingTouchSlop.

static final int
UNDEFINED_DURATION = -2147483648

Constant that represents that a duration has not been defined.

static final int
From android.view.View
static final int
static final int
static final int
static final int
static final int
static final int
static final Property<ViewFloat>
static final int
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE = "creditCardExpirationDate"
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY = "creditCardExpirationDay"
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH = "creditCardExpirationMonth"
static final String
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR = "creditCardExpirationYear"
static final String
static final String
AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE = "creditCardSecurityCode"
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int
static final int
static final int
static final int
static final int
static final int
static final int[]
static final int[]
static final int[]
static final int[]
static final int
static final int
static final int
static final int
static final int
static final int
static final int
GONE = 8
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
KEEP_SCREEN_ON = 67108864
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
NO_ID = -1
static final int
static final int
static final int
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final int[]
static final float
static final float
static final float
static final float
static final float
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int[]
static final int[]
static final int
static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
static final String
VIEW_LOG_TAG = "View"
static final int
static final int[]
static final Property<ViewFloat>
static final Property<ViewFloat>
static final Property<ViewFloat>
From android.view.ViewGroup
static final int
static final int
static final int
static final int
static final int
static final int
static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

Inherited methods

From androidx.leanback.widget.BaseGridView
void

Registers a callback to be invoked when an item in BaseGridView has been selected.

final void

Registers a callback to be invoked when the BaseGridView completes a full layout calculation.

void

Undo animateOut() and slide in child views.

void

Temporarily slide out child views to bottom (for VerticalGridView) or end (for HorizontalGridView).

boolean
boolean
boolean
@Nullable View
focusSearch(int direction)
int
getChildDrawingOrder(int childCount, int i)
int

This method is deprecated.

Use getHorizontalSpacing

int

Returns the horizontal spacing in pixels between two child items.

int

Gets the number of items to prefetch in collectInitialPrefetchPositions, which defines how many inner items should be prefetched when this GridView is nested inside another RecyclerView.

int

Returns number of pixels to the end of low edge.

float

Returns the offset percent for item alignment in addition to getItemAlignmentOffset.

int

Returns the id of the view to align with, or NO_ID for the root itemView.

@Nullable BaseGridView.OnUnhandledKeyListener

Returns the unhandled key listener.

final int

Returns the limit used when when getSaveChildrenPolicy is SAVE_LIMITED_CHILD

final int

Returns the policy for saving children.

int

Returns the adapter position of selected item.

@Nullable BaseGridView.SmoothScrollByBehavior

Returns custom behavior for smoothScrollBy().

final int

When holding DPAD, DPAD events are generated faster than the grid view can scroll.

final float
int

This method is deprecated.

Use getVerticalSpacing

int

Returns the vertical spacing in pixels between two child items.

void
getViewSelectedOffsets(@NonNull View view, @NonNull int[] offsets)

Returns the x/y offsets to final position from current position if the view is selected.

int

Returns the method for focused item alignment in the view.

int

Returns the offset in pixels for window alignment key line.

float

Returns the offset percent for window alignment key line in addition to getWindowAlignmentOffset.

boolean
boolean

Returns true if the view at the given position has a same row sibling in front of it.

boolean

Returns true if an animation will run when a child changes size or when adding or removing a child.

boolean

Returns true if draws selected child at last, false otherwise.

final boolean

Returns true if focus search is disabled.

boolean

Returns true if applies padding to item alignment when getItemAlignmentOffsetPercent is 0 or 100; returns false otherwise.

boolean

Returns true if scrolling is enabled, false otherwise.

boolean

Returns whether prefer key line over high edge when WINDOW_ALIGN_HIGH_EDGE is used.

boolean

Returns whether prefer key line over low edge when WINDOW_ALIGN_LOW_EDGE is used.

void
onFocusChanged(
    boolean gainFocus,
    int direction,
    @Nullable Rect previouslyFocusedRect
)
boolean
onRequestFocusInDescendants(
    int direction,
    @Nullable Rect previouslyFocusedRect
)
void
onRtlPropertiesChanged(int layoutDirection)

Notify layout manager that layout directionality has been updated

void

Remove the callback invoked when an item in BaseGridView has been selected.

final void

Removes a callback to be invoked when the BaseGridView completes a full layout calculation.

void
void
removeViewAt(int index)
void
scrollToPosition(int position)

Convenience method to scroll to a certain position.

void
setAnimateChildLayout(boolean animateChildLayout)

Sets whether ItemAnimator should run when a child changes size or when adding or removing a child.

void
setChildrenVisibility(int visibility)

Changes and overrides children's visibility.

void
setFocusDrawingOrderEnabled(boolean enabled)

Enables or disables the default "focus draw at last" order rule.

final void
setFocusSearchDisabled(boolean disabled)

Disables or enables focus search.

void
setGravity(int gravity)

Sets the gravity used for child view positioning.

void
setHasOverlappingRendering(boolean hasOverlapping)
void
setHorizontalMargin(int margin)

This method is deprecated.

Use setHorizontalSpacing

void
setHorizontalSpacing(int spacing)

Sets the horizontal spacing in pixels between two child items.

void

Sets the number of items to prefetch in collectInitialPrefetchPositions, which defines how many inner items should be prefetched when this GridView is nested inside another RecyclerView.

void

Sets number of pixels to the end of low edge.

void
setItemAlignmentOffsetPercent(float offsetPercent)

Sets the offset percent for item alignment in addition to