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
my solution. dynamically:
public class RTLViewPager extends ViewPager {
public RTLViewPager(Context context) {
super(context);
}
public RTLViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void setAdapter(PagerAdapter adapter) {
super.setAdapter(adapter);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
if(getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL){
setCurrentItem(adapter.getCount()-1);
}
}
}
}