Set default page for ViewPager in Android

前端 未结 5 2096
孤独总比滥情好
孤独总比滥情好 2020-11-30 02:04

I am using the following code, MAX is 2 pages. By default the position is 0 and adds a new page to the right. I inflate two layout files.

How can I show the page1 wh

5条回答
  •  粉色の甜心
    2020-11-30 02:58

    By default, you have to set the current value 1 to show the just one default view. If you do not set setCurrentItem to 1, you can not see anything.

    viewPager.setAdapter(adapterViewPager);
    viewPager.setCurrentItem(1)
    

提交回复
热议问题