Android viewpage implements controllable no sliding

Android programming often uses viewpager combined with fragment to realize pages that can slide and switch left and right, but sometimes there is a need to let viewpager control whether it slides according to specific conditions.

Implementation idea: rewrite the viewpager, override the ontouchevent and onintercepttouchevent methods, make them return false, and intercept the event response of the viewpager. In this way, the sliding event on the viewpager is prohibited.

After initializing MyViewPager in Java code, calling setScrollble () method can control whether ViewPager is sliding, false is not slippage, true is sliding.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>