Android 12 Developer Preview is here! Try it out, and give us your feedback!

LeanbackViewPager

public class LeanbackViewPager
extends ViewPager

java.lang.Object
   ↳ 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

Inherited fields

Public constructors

LeanbackViewPager(Context context)

Constructs LeanbackViewPager

LeanbackViewPager(Context context, AttributeSet attrs)

Constructs LeanbackViewPager

Public methods

boolean executeKeyEvent(KeyEvent event)

You can call this function yourself to have the scroll view perform scrolling from a key event, just as if the event had been dispatched to it by the view hierarchy.

boolean onInterceptTouchEvent(MotionEvent event)
boolean onTouchEvent(MotionEvent event)
void setKeyEventsEnabled(boolean enableKeyEvent)

Setter for enabling/disabling key events

void setTouchEnabled(boolean enableTouch)

Setter for enabling/disabling touch events

Inherited methods

Public constructors

LeanbackViewPager

public LeanbackViewPager (Context context)

Constructs LeanbackViewPager

LeanbackViewPager

public LeanbackViewPager (Context context, 
                Att