EasyTabs icon indicating copy to clipboard operation
EasyTabs copied to clipboard

bug: setCurrentItem() does not scroll tab to proper position

Open or-dvir opened this issue 8 years ago • 1 comments

hi i found a bug when setting current page of viewpager programatically. i have this piece of code:

`EasyTabsBuilder.with(mTabs)
					   .addTabs(tabsArray)
					   .setTabLayoutScrollable(true)
					   .Build();

		mTabs.getViewPager().setCurrentItem(tabToSelect);`

the content is fine, it shows the tabToSelect fragment. however the tablayout is not scrolling and still showing original position.

see these photo: 19141798_10154746824825208_342615726_n

notice that the content says "10" - thats the content for tab number 10, but the tab layout is still in the initial position

or-dvir avatar Jun 13 '17 04:06 or-dvir

this is working:

EasyTabsBuilder.with(mTabs)
					   .addTabs(tabsArray)
					   .setTabLayoutScrollable(true)
					   .Build();

		mTabs.post(new Runnable()
		{
			@Override
			public void run()
			{
				mTabs.getViewPager().setCurrentItem(tabToSelect);
			}
		});

or-dvir avatar Jun 13 '17 05:06 or-dvir