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

LeanbackViewPager

open class LeanbackViewPager : ViewPager
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ androidx.viewpager.widget.ViewPager
   ↳ androidx.leanback.tab.LeanbackViewPager

A viewpager with touch and key event handling disabled by default.

Key events handling is disabled by default as with the behaviour of viewpager the fragments can change when DPAD keys are pressed and focus is on the content inside the ViewPager. This is not desirable for a top navigation bar. The fragments should preferably change only when the focused tab changes.

Summary

Inherited constants
Public constructors
<init>(@NonNull context: Context)

Constructs LeanbackViewPager

<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?)

Constructs LeanbackViewPager

Public methods
open Boolean
executeKeyEvent(@NonNull event: KeyEvent)

open Boolean

open Boolean
onTouchEvent(@NonNull event: MotionEvent)

open Unit
setKeyEventsEnabled(enableKeyEvent: Boolean)

Setter for enabling/disabling key events

open Unit
setTouchEnabled(enableTouch: Boolean)

Setter for enabling/disabling touch events

Inherited functions

Public constructors

<init>

LeanbackViewPager(@NonNull context: Context)

Constructs LeanbackViewPager

Parameters
context Context:

<init>

LeanbackViewPager(
    @NonNull context: Context,
    @Nullable attrs: AttributeSet?)

Constructs LeanbackViewPager

Parameters
context Context:
attrs AttributeSet?:

Public methods

executeKeyEvent

open fun executeKeyEvent(@NonNull event: KeyEvent): Boolean

onInterceptTouchEvent

open fun onInterceptTouchEvent(@NonNull event: MotionEvent): Boolean

onTouchEvent

open fun onTouchEvent(@NonNull event: MotionEvent): Boolean

setKeyEventsEnabled

open fun setKeyEventsEnabled(enableKeyEvent: Boolean): Unit

Setter for enabling/disabling key events

Parameters
enableKeyEvent Boolean:

setTouchEnabled

open fun setTouchEnabled(enableTouch: Boolean): Unit

Setter for enabling/disabling touch events

Parameters
enableTouch Boolean: