Google 致力于为黑人社区推动种族平等。查看具体举措

LinearLayoutManager

open class LinearLayoutManager : RecyclerView.LayoutManager, ItemTouchHelper.ViewDropHandler, RecyclerView.SmoothScroller.ScrollVectorProvider
kotlin.Any
   ↳ androidx.recyclerview.widget.RecyclerView.LayoutManager
   ↳ androidx.recyclerview.widget.LinearLayoutManager

A RecyclerView.LayoutManager implementation which provides similar functionality to android.widget.ListView.

Summary

Nested classes
open

Constants
static Int

static Int

static Int

Public constructors
<init>(context: Context!)

Creates a vertical LinearLayoutManager

<init>(context: Context!, orientation: Int, reverseLayout: Boolean)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Constructor used when layout manager is set in XML by RecyclerView attribute "layoutManager".

Public methods
open Unit

open Boolean

open Boolean

open Unit

open Unit

open Int

open Int

open Int

open PointF?

open Int

open Int

open Int

open Int

Returns the adapter position of the first fully visible view.

open Int

Returns the adapter position of the first visible view.

open Int

Returns the adapter position of the last fully visible view.

open Int

Returns the adapter position of the last visible view.

open View?

Finds the view which represents the given adapter position.

open RecyclerView.LayoutParams!

Create a default LayoutParams object for a child of the RecyclerView.

open Int

Gets the number of items to prefetch in collectInitialPrefetchPositions(int, LayoutPrefetchRegistry), which defines how many inner items should be prefetched when this LayoutManager's RecyclerView is nested inside another RecyclerView.

open Int

Returns the current orientation of the layout.

open Boolean

Returns whether LayoutManager will recycle its children when it is detached from RecyclerView.

open Boolean

Returns if views are laid out from the opposite direction of the layout.

open Boolean

open Boolean

open Boolean

Returns the current state of the smooth scrollbar feature.

open Unit

open View?
onFocusSearchFailed(focused: View, focusDirection: Int, recycler: RecyclerView.Recycler, state: RecyclerView.State)

open Unit

open Unit

Lay out all relevant child views from the given adapter.

open Unit

open Unit

open Parcelable?

open Unit
prepareForDrop(@NonNull view: View, @NonNull target: View, x: Int, y: Int)

Called by the ItemTouchHelper after a View is dropped over another View.

open Int

Scroll horizontally by dx pixels in screen coordinates and return the distance traveled.

open Unit
scrollToPosition(position: Int)

Scroll the RecyclerView to make the position visible.

open Unit
scrollToPositionWithOffset(position: Int, offset: Int)

Scroll to the specified adapter position with the given offset from resolved layout start.

open Int

Scroll vertically by dy pixels in screen coordinates and return the distance traveled.

open Unit

Sets the number of items to prefetch in collectInitialPrefetchPositions(int, LayoutPrefetchRegistry), which defines how many inner items should be prefetched when this LayoutManager's RecyclerView is nested inside another RecyclerView.

open Unit
setOrientation(orientation: Int)

Sets the orientation of the layout.

open Unit
setRecycleChildrenOnDetach(recycleChildrenOnDetach: Boolean)

Set whether LayoutManager will recycle its children when it is detached from RecyclerView.

open Unit
setReverseLayout(reverseLayout: Boolean)

Used to reverse item traversal and layout order.

open Unit

When smooth scrollbar is enabled, the position and size of the scrollbar thumb is computed based on the number of visible pixels in the visible items.

open Unit
setStackFromEnd(stackFromEnd: Boolean)

Compatibility support for android.widget.AbsListView#setStackFromBottom(boolean)

open Unit
smoothScrollToPosition(recyclerView: RecyclerView!, state: RecyclerView.State!, position: Int)

open Boolean

Protected methods
open Unit
calculateExtraLayoutSpace(@NonNull state: RecyclerView.State, @NonNull extraLayoutSpace: IntArray)

Calculates the amount of extra space (in pixels) that should be laid out by and stores the result in extraLayoutSpace.

open Int

Returns the amount of extra space that should be laid out by LayoutManager.

open Boolean

Inherited functions