I have viewPager with several views. the default behavior of viewPager is that the first item is displayed first, then swiping right to left displays the second view right t
You can simply use setCurrentItem()
to navigate to the last page in the ViewPager when it's attached to the View.
why don't you reverse the list of you view in view pager and use setCurrentItem(int) or setCurrentItem(int,boolean) and set the last one at the launch of the activity/fragment..
you can now show items horizontally in Recyclerview.
There have an option to show recyclerview items as reverse order.
RecyclerView recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, true)); // last parameter is isReverse
If you want to show RecyclerView items like ViewPager paging you should to use this library:
https://github.com/lsjwzh/RecyclerViewPager
This codes will show RecyclerView as Reverse Order ViewPager.
Here is the code:
RecyclerViewPager recyclerViewPager = findViewById(R.id.recyclerViewPager);
recyclerViewPager.setLayoutManager(new LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, true));
repositories {
...
maven { url "https://jitpack.io" }
...
}
dependencies {
...
compile 'com.github.lsjwzh.RecyclerViewPager:lib:v1.1.2@aar'
...
}