I implement a sliding tab layout under the toolbar in android, and everything is displayed on the screen and works, agreeing that touching the tabs will do nothing - only scrolling will work.
My main need is to actually disable scrolling and use it like regular tabs. What am I missing?
I believe that I configured correctly:
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPage);
viewPager.setAdapter(new MyPagerAdapter(getSupportFragmentManager(), getFragments()));
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.tabs);
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(viewPager);
And in XML:
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:layout_height="60dp"
android:id="@+id/toolbar"
android:minHeight="?attr/actionBarSize"
android:background="@color/da_blue" />
<dapulse.dapulse.com.dapulse.app.SlidingTabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/toolbar"
android:id="@+id/tabs"></dapulse.dapulse.com.dapulse.app.SlidingTabLayout>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/viewPage"></android.support.v4.view.ViewPager>
source
share