TabLayout Control Scroll Position
<p>So I have a TabLayout setup with a ViewPager, as such below. Right now when I scroll horizontally from tab to tab or select a tab by tapping the title it will center the selected tab, however I want to shift the scroll position all the way to the right or left depending on the selected tab. I'm trying to achieve what was done in the Fitocracy app, with pictures shown below:</p>

<p><a href="https://i.imgur.com/u7IlkzP.jpg" rel="nofollow noreferrer"><img src="https://i.imgur.com/u7IlkzPm.jpg" alt=""></a> <a href="https://i.imgur.com/sMYMZ2N.jpg" rel="nofollow noreferrer"><img src="https://i.imgur.com/sMYMZ2Nm.jpg" alt=""></a></p>

<p>Basically you can either see one whole week or the other, never will any day besides Sunday be on the left.</p>

<p>I tried to simply scroll all the way to the right by using <code>setScrollX</code> and my screen width however that did nothing.</p>

<pre><code>final CustomTabLayout tabLayout = (CustomTabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);

    tabLayout.setOnTabSelectedListener(
            new TabLayout.ViewPagerOnTabSelectedListener(viewPager) {
                @Override
                public void onTabSelected(TabLayout.Tab tab) {
                    super.onTabSelected(tab);
                    int tabNum = viewPager.getCurrentItem();
                    Display display = getWindowManager().getDefaultDisplay();
                    Point size = new Point();
                    display.getSize(size);
                    int width = size.x;

                    Log.e("MainActivity","Current tabNum: " + tabNum);
                    if (tabNum &gt;= 7) {
                        Log.e("MainActivity", "Scroll position: " + tabLayout.getScrollX());
                        tabLayout.setScrollX(width);
                    }
                }
            });
</code></pre>

<p>Any help is appreciated!</p>