Reputation: 811
In my project I am using ViewTabPager library https://github.com/JakeWharton/Android-ViewPagerIndicator . It's working fine but my requirement is when i select any tab i wanted to show the tab in center.Is it possible to do? I wanted show the selected tab in center from the O position.
If you have any solution please help me.
Upvotes: 0
Views: 373
Reputation: 3602
i have this in my code and just works
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
int scrollX = (mTabHost.getTabWidget().getChildAt(position).getLeft() - (screenWidth / 2)) + (mTabHost.getTabWidget().getChildAt(position).getWidth() / 2);
((HorizontalScrollView) findViewById(R.id.scrlTabs)).scrollTo(scrollX, 0);
}
hope this help
Upvotes: 1