PagerAdapter start position

前端 未结 9 1101

I\'m using the following example to impliment my viewPager: http://code.google.com/p/viewpagerexample/issues/list

The problem with this example is that I can\'t figure o

9条回答
  •  一生所求
    2021-01-30 08:40

    I came across a problem whereby if I set the current item before I set the adapter, the first item I get back will always be the one at position 0.

    Make sure you do:

    awesomePager.setAdapter(awesomeAdapter);
    awesomePager.setCurrentItem(CurrentPosition);
    

    and not:

    awesomePager.setCurrentItem(CurrentPosition);
    awesomePager.setAdapter(awesomeAdapter);
    

提交回复
热议问题