I am using view pager but want to use more than four tabs. How can I achieve that?

So if I get more than four tabs then their begin to shrink and does not look, and so I want more than four tabs but don’t want them to shrink.

Thanks in advance.

Try to set the Tabs mode property to Fixed :slightly_smiling_face: That’s how it should look like:

Thanks It worked!!! :grinning:

I am also trying to set an icon on the tab of view pager, any idea on how I can achieve that?

Unfortunately, you can’t, but you could hide the tabs using this property:


In the experimental category, to hide the view pager tabs, and use the TabLayout component instead, which allows you to set a tab icon :blush:

1 Like

I tried your solution but when used together it does give the desired result.
they don’t sync as expected when swiped.

blocks (2)

blocks (3)

tabs don’t get active when view pager is swiped.

Use select tab property with the position variable in the ViewPager.PageSelected event, same for the TabItem selected event, you don’t need to use If then block :wink: Also you might need to subtract the view pager position variable by one as it starts from 0 not 1:

1 Like

can you share the blocks image, it will save me a lot of time.

Thanks in advance. :grinning:

1 Like

@Mohamed_Tamer is a very nice person, but the time it would take them to make it compared to the time you would make it is equivalent. Plus it’s nice to learn for yourself once in a while!

Since I understand what @Mohamed_Tamer is saying, here’s an example, but without the blocks.

when View_Pager2.PageSelected(int position) {
  set Tab_Layout1.selectTab(get position - 1);
}

when Tab_Layout1.TabItemSelected(String tab, int position) {
  set View_Pager2.selectTab(get position - 1);
}
1 Like

Actually, its not about the time.
The problem is, I know his solution is right, but haven’t figured out yet. else would have done it myself. Dont like to trouble community people.

If you know something it is a two minutes job for to show the blocks.

And yup, he is a nice person and solve queries really well.

1 Like

@Mohamed_Tamer show the blocks :crying_cat_face:

1 Like

Thanks :smiling_face_with_three_hearts:

It’s always better to try your self , but since you haven’t figure out how to do it neither from my post nor from @hammerhai’s example, so I would show you the blocks that i’ve commented it out, so you can learn how they work :slightly_smiling_face:

2 Likes

Wow!! It worked !!
And thanks a lot for such a great explanation. Understood it!

1 Like

Then please close the topic by marking the solution :upside_down_face:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.