Bug 23894 - Xamarin.Forms - Android - XAlign issue
Summary: Xamarin.Forms - Android - XAlign issue
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-10-17 04:19 UTC by Bart
Modified: 2016-03-18 08:47 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
XAlignment.Center issue screenshot - not centering on Android - shown with a red circle. (248.64 KB, application/octet-stream)
2014-10-17 04:19 UTC, Bart
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Bart 2014-10-17 04:19:14 UTC
Created attachment 8440 [details]
XAlignment.Center issue screenshot - not centering on Android - shown with a red circle.

I've been using Xamarin.Forms for a while now and I am still experiencing an issue on the Android platform with the XALign property.

            Label label = new Label()
            {
                BackgroundColor = Color.Transparent,
                XAlign = TextAlignment.Center,
                WidthRequest = size / 2,
                TextColor = Color.White,
                HeightRequest = 20,
                YAlign = TextAlignment.End
            };

I'm using a grid with a couple of columns and rows with this label (Let's say about 20 labels on one screen). At random it is ignoring the TextAlignment.Center and is aligning the text to the left. The issue is visible on multiple places on the grid when navigating very fast multiple times. 

I'm experiencing this issue from on launch of Xamarin.Forms till the latest version. I'm also using the same view on iOS & Windows Phone but not experiencing the issue on those platforms.

In the attachment the problems are shown with a red circle.
Comment 1 Rajneesh Kumar 2014-10-17 07:41:46 UTC
I have checked this issue and unable to reproduce this issue. To reproduce this issue I have followed the instruction provided in bug description. As above described I also created xamarin forms application and apply the give code.

Steps I followed:

1. Create a xamarin forms application (Portable)
2. Add a XAML page name "MyPage"
3. Paste the following code in "MyPage.xaml.cs" page
                        Label label = new Label()
			{
				Text="Hello",
				BackgroundColor = Color.White,
				XAlign = TextAlignment.Center,
				WidthRequest =100,
				TextColor = Color.Red,
				HeightRequest = 40,
				YAlign = TextAlignment.End
			};

			Content	=new StackLayout
			   {
				Spacing=10, Children={label}
			   };
4. Call "MyPage" in App.cs page and run the application on emulator
5. Observe that the "XAlign = TextAlignment.Center" is working

Could you please provide us small sample application that reproduce issue, environment info ?Or please let me know that what steps I am missing to reproduce this. That will be very helpful to reproduce this issue at our
end.

Screencast: http://www.screencast.com/t/VEZafxUkWl9

Environment Info: 
=== Xamarin Studio ===

Version 5.5.2 (build 0)
Installation UUID: a7e29e93-6348-4126-9ebc-b2777c96a552
Runtime:
	Microsoft .NET 4.0.30319.18408
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

=== Xamarin.Android ===

Version: 4.18.0 (Business Edition)
Android SDK: E:\android-sdk
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode)

=== Build Information ===

Release ID: 505020000
Git revision: a5887be38215a6cdd3f349e102ef82a1c4f950a4
Build date: 2014-10-14 12:21:34-04
Xamarin addins: 069ddd29bb70a42238142eee9bac21a5e4b2f9f9

=== Operating System ===

Windows 6.2.9200.0 (64-bit)
Comment 2 Jason Smith [MSFT] 2016-03-18 08:47:35 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we no longer believe it affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
 
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team