Home > other >  I'm having 6 tabitem but i want to show only 3 tabitem at a time, as u can see a small part of
I'm having 6 tabitem but i want to show only 3 tabitem at a time, as u can see a small part of

Time:12-06

Tablayout

I'm having 6 tabitem but i want to show only 3 tabitem at a time, as u can see a small part of next tabitem is visible so as i slide next 3 tabitem should appear ?

CodePudding user response:

In your MainActivity

ViewPager mpager;

TabPageAdapter adapter = new TabPageAdapter(getSupportFragmentManager(), list);

mtabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
mpager.setOffscreenPageLimit(list.size());

mpager.setAdapter(adapter);

In your xml TabLayout set

app:tabMode="scrollable"

CodePudding user response:

you can use this library , and handle the number of visible item

  • Related