I have a label inside the stack layout. This HorizontalTextAlignment parameter is set to TextAlignment.Center . It works correctly when the page is first loaded and when a new value is selected - however, when the page remains and then returns, it loses alignment. This is only a problem on Android, not on iOS. I hope the illustration below helps illustrate my point. This is the only code that affects label alignment, except that it just changes the text through the anchor, but I donβt see how this will change its alignment. Any ideas? Thanks.
StackLayout durationLayout = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = (App.ScreenDpWidth / 3) - (GMStyle.Margin.PageMargin.Left * 2), VerticalOptions = LayoutOptions.Center, Margin = new Thickness(0, 5, 0, 0), HorizontalOptions = LayoutOptions.Start }; durationLabel = new Label { Style = (Style)Application.Current.Resources["DurationLabelStyle"], HorizontalTextAlignment = TextAlignment.Center,

xamarin xamarin.forms
Will nasby
source share