skip to Main Content

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
?

2

Answers


  1. 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"
    
    Login or Signup to reply.
  2. you can use this library , and handle the number of visible item

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search