I have a viewpager and it contains some information but it lets me swipe the pages from left to right how can I make it swipe from left to right which means change its direc
For letting your horizontal ViewPager behave like RecyclerView when LayoutDirection change just add this method to your custom ViewPager;
public class LoopViewPager extends ViewPager {
....
...
public void setLayoutDirection(int layoutDirection) {
if(layoutDirection == ViewCompat.LAYOUT_DIRECTION_LTR) {
setRotationY(0);
}
else if(layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL) {
setRotationY(180);
}
}
and where you use your viewPager set it dynamically like this;
viewPager.setLayoutDirection(context.getResources().getConfiguration().getLayoutDirection());