I want lock / disable one particular page(fragment) in viewpager. According to scenario for some people only able to access that page. How restrict swiping to that page.
I disabled tab click for Events page by using following code :
LinearLayout tabStrip = ((LinearLayout)tabLayout.getChildAt(0));
if(!isAccess){
tabStrip.getChildAt(3).setClickable(false);
tabStrip.getChildAt(3).setEnabled(false);
}
But now I need to restrict swiping for that page in view pager. How to do this?
I written this in pager adapter it works.
@Override
public int getCount() {
if(!isAccess) {
return 3;
} else {
return 4;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With