Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 58441 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 23852 [details]
If I have more tabs than fit the screen, on Android I can set the tabmode to scrollable.
But if I programmatically set the selected item (either with SelectedItem or CurrentPage) to a tab out of the screen, on Android, the tabs doesn't scroll to the selected tab, always showing the first tabs.
On UWP it's working fine, on iOS it doesn't work because it uses the "more" button.
But on Android, it is selecting the right Child, displaying its content, but not scrolling the tabs to show the right tab (if it's out of the screen) on the tabs bar.
If I scroll the tabs manually, the correct tab is selected, but this user experience is really bad.
I'm attaching a sample project to test it. Once the Open TabbedPage is clicked, it will open the TabbedPage and show the Tab 10 content, but the tabs will still be showing Tab 1, 2, 3 and 4.
I was able to reproduce this issue on Android using the attached repro project.
### Steps to Reproduce
1. Run the attached Android project
2. Press "Open TabbedPage"
### Expected Results
The TabbedPage will display and the tab bar will show that "Tab 10" is selected.
### Actual Results
The TabbedPage is opened and the "Tab 10" page contents are displayed however the tab bar does not show the "Tab 10" tab unless you scroll to it.
### Additional Information
This happens when the Android TabLayout TabMode is set to be scrollable. If using the default, fixed setting then all the tabs are visible but sized to fit horizontally.
### Version Tests
I managed to workaround the problem with an Android Renderer.
(thanks to this guy: https://stackoverflow.com/questions/45356270/how-to-force-xamarin-forms-tabbedpage-to-scroll-to-selected-tab-progammatically/45406150#45406150 )
So I guess all it needs is to fix it in the default Android Renderer.
public class MyTabbedPageRenderer : TabbedPageRenderer
private TabLayout tabLayout = null;
protected override void OnElementChanged(ElementChangedEventArgs<TabbedPage> e)
this.tabLayout = (TabLayout)this.GetChildAt(1);
var selectPosition = this.tabLayout.SelectedTabPosition;
tabLayout.TabMode = TabLayout.ModeScrollable;
tabLayout.TabGravity = TabLayout.GravityFill;
Handler h = new Handler();
Action myAction = () =>
This is still a bug.
The bug isn't so much that it's hard to change. The bug is that it defaults to the wrong mode. The mode that it defaults to is mismatched with other platforms. Out of the box, any controls in Xamarin Forms should behave exactly the same as controls on other platforms, even when this does not match the platform's default behaviour.