New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(android): Fixes TabLayout gravity when changing orientation #10687
Conversation
Takes care of switching a TabLayout's TabGravity depending on current orientation.
|
} else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { | ||
mTabLayout.setTabGravity(TabLayout.GRAVITY_CENTER); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit-pick. You can get rid of the mTabLayout.
part since you're overriding the TabLayout
class' onConfigurationChanged()
method. The rest is fine. Nice and simple solution. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR: Pass
FR Passed. |
JIRA: https://jira.appcelerator.org/browse/TIMOB-26698
Description:
Takes care of switching a TabLayout's TabGravity depending on current orientation. Due to Titanium not recreating activities on orientation changes the style defined for the TabLayout in Design support library will not be applied, because the TabLayout won't be redrawn. This PR makes the change on configurationChanged event and effectively changes the component according to the new style. The change from the default style is actually only the tabGravity property.
Edit: No unit test for this one - it is a visual change.
Test case:
There is a good code sample in the JIRA ticket.