Is it possible to enable-disable swiping in new android viewpager2
component?
Now it is possible to enable-disable swiping viewpager2
using Version 1.0.0-alpha02
Use implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha02'
New features
setUserInputEnabled
, isUserInputEnabled
)API changes
ViewPager2
class finalBug fixes
FragmentStateAdapter
stability fixesSAMPLE CODE to disable swiping in viewpager2
myViewPager2.setUserInputEnabled(false);
SAMPLE CODE to enable swiping in viewpager2
myViewPager2.setUserInputEnabled(true);