florent37 / MaterialViewPager

A Material Design ViewPager easy to use library
https://www.fiches-plateau-moto.fr
Apache License 2.0
8.15k stars 1.48k forks source link

MaterialViewPager full tab text (full width) #325

Open r4hulp opened 7 years ago

r4hulp commented 7 years ago

Hi,

First of all, thanks for this wonderful library. I am totally loving working on it. However I have one issue.

I have five tabs, some of them are little longer. But I purposely want to show full name of theirs. Right now the pager titles are getting truncated and replaced with ... (e.g. Professionalism with Prof...).

I could not find any setting that forces tab to be of full text / width.

Any help would be great.

vivekkumar12hpe commented 7 years ago

Please help on this I am facing the same issue.

sonimusaj commented 7 years ago

In material_view_pager_pagertitlestrip_standard layout you are using set android:layout_width to wrap_content.

You can access material_view_pager_pagertitlestrip_standard from activity_main.xml press CTRL and click on app:viewpager_pagerTitleStrip="@layout/material_view_pager_pagertitlestrip_standard" title

ricardocatarinoaltran commented 6 years ago

Same problem here. The solution was to create a tab bar, just like in the description https://github.com/florent37/MaterialViewPager#or-create-your-own-tab-bar

and then put the app:pstsPaddingMiddle="false"

dushaofeng commented 6 years ago

The solution was to create a tab bar,and make "app:pstsShouldExpand" to false,NOT make "app:pstsPaddingMiddle" to false.

You can see the PagerSlidingTabStrip source code like this: mTabLayoutParams = isExpandTabs ? new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) : new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);