Skip to content

Conversation

@bartoszfilipowicz
Copy link

With current implementation using shouldExpand="true" with tabs that aren't of the same width may result in cropping longer tab labels.

This is due to setting

new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f)

layout params for every tab whenever the tabs are expanded to fill the whole screen width.

This fix gets weight from the width of the tab:

new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, tabView.getMeasuredWidth())

during the fitting. Thanks to that, the tabs retain their previous proportions.

Current behaviour:

before

After applying this fix:

after

silentnuke-old added a commit to silentnuke-old/PagerSlidingTabStriptest that referenced this pull request Jun 27, 2014
axsddlr added a commit to AOSPA-legacy/android_packages_apps_Settings that referenced this pull request Jul 9, 2014
-- Check if tabCount > 0
(do this before attempting tabsContainer.getChildAt(position) when scrolling to child.)

-- if pager == null no need to call requestLayout()

-- make shouldExpand work correctly
   (referenced here: astuetz/PagerSlidingTabStrip#42)
-- Use Gravity to center tabs

-- add onTabReselected() callbackFunction
  ( referenced here: astuetz/PagerSlidingTabStrip#92)

Change-Id: I0184de3c010a902a721572d3dcaa75101e38aa0c
Signed-off-by: Andre Saddler <[email protected]>
axsddlr added a commit to AOSPA-legacy/android_packages_apps_Settings that referenced this pull request Jul 9, 2014
-- Check if tabCount > 0
(do this before attempting tabsContainer.getChildAt(position) when scrolling to child.)

-- if pager == null no need to call requestLayout()

-- make shouldExpand work correctly
   (referenced here: astuetz/PagerSlidingTabStrip#42)
-- Use Gravity to center tabs

-- add onTabReselected() callbackFunction
  (referenced here: astuetz/PagerSlidingTabStrip#92)

-- Fix: Tab dislocation caused by setViewPager

Change-Id: I0184de3c010a902a721572d3dcaa75101e38aa0c
Signed-off-by: Andre Saddler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant