How to create TabLayout without viewPager?

I created a toolbar with a tab (Background, TextStyle, font). But I followed servo textbooks on the Internet, and they all have a viewPager / slider that I don't want. So how do I create it without implementing a viewPager?

So far, I know this has something to do with this:

@Override public void onTabSelected(TabLayout.Tab tab) { } 

+5
source share
2 answers

Code example:

 private void onCreateTabLayout() { mTabLayout.addTab(mTabLayout.newTab().setIcon(R.drawable.ic_directions_car_24dp)); mTabLayout.addTab(mTabLayout.newTab().setIcon(R.drawable.ic_directions_walk_24dp)); mTabLayout.addTab(mTabLayout.newTab().setIcon(R.drawable.ic_directions_bike_24dp)); mTabLayout.setOnTabSelectedListener(this); } 
+13
source

I solved my problem using this code: fooobar.com/questions/18608 / ...

he did exactly what I wanted, which deactivated touch scrolling between my fragments and allowed β€œclicks” on tabs

0
source

All Articles