xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.87k forks source link

[Bug] Adding NavigationPage as Child of TabbedPage changes Button text alignment #8304

Open pmahend1 opened 4 years ago

pmahend1 commented 4 years ago

Description

Making NavigationPage children to be of TabbedPage works fine on iOS but on Android, it shifts the button text . Its pretty weird UX

When you see the Button's text it aligns to left sometimes

How to fix this?

Steps to Reproduce

Screen Shot 2019-10-29 at 2 20 13 PM

<?xml version="1.0" encoding="utf-8"?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
            android:TabbedPage.ToolbarPlacement="Bottom"
            android:TabbedPage.IsSwipePagingEnabled="False"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            x:Class="ButtonTextAlignmentIssue.BaseTabbedPage"
            BarBackgroundColor="Navy"
            SelectedTabColor="Red"
            UnselectedTabColor="White"
            BarTextColor="Red">

</TabbedPage>

 public partial class BaseTabbedPage : TabbedPage
    {
        public BaseTabbedPage()
        {

            InitializeComponent();
            var page1 = new NavigationPage(new ContentPage() { Title = "Tab 1", Content = new Label { Text = "page 1" } }) { Title = "Tab1" };
            var page2 = new NavigationPage(new MainPage() { Title = "Tab 2" }) { Title = "Tab 2" };
            var page3 = new NavigationPage(new ContentPage() { Title = "Tab 3", Content = new Label { Text = "page 3" } }) { Title = "Tab 3" };
            var page4 = new NavigationPage(new MainPage() { Title = "Tab 4" }) { Title = "Tab 4" };
            var page5 = new NavigationPage(new ContentPage() { Title = "Tab 5", Content = new Label { Text = "page 5" } }) { Title = " Tab 5" };
            this.Children.Add(page1);
            this.Children.Add(page2); 

            this.Children.Add(page3);
            this.Children.Add(page4);

            this.Children.Add(page5);

        }

However if only NavigationPage is used for a page then this issue does not appear.

MainPage = new NavigationPage(new MainPage());

image

Expected Behavior

Should not change the text alignment

Actual Behavior

Button text alignment to left

Basic Information

Screenshots

Reproduction Link

Github

Will upload in few minutes

pmahend1 commented 4 years ago

reproduction link https://github.com/pmahend1/XamarinFormsIssues/tree/master/ButtonTextAlignmentIssue

pmahend1 commented 4 years ago

Is there a workaround or solution for this?