Update LabelRenderer.cs (#8571) fixes #7019
authorGerald Versluis <gerald.versluis@microsoft.com>
Fri, 22 Nov 2019 14:51:22 +0000 (15:51 +0100)
committerRui Marinho <me@ruimarinho.net>
Fri, 22 Nov 2019 14:51:22 +0000 (14:51 +0000)
Xamarin.Forms.Platform.Android/FastRenderers/LabelRenderer.cs

index eadd780..65879ca 100644 (file)
@@ -115,8 +115,17 @@ namespace Xamarin.Forms.Platform.Android.FastRenderers
                                        return _lastSizeRequest.Value;
                        }
 
+                       //We need to clear the Hint or else it will interfere with the sizing of the Label
+                       var hint = Control.Hint;
+                       if (!string.IsNullOrEmpty(hint))
+                               Control.Hint = string.Empty;
+
                        Measure(widthConstraint, heightConstraint);
-                       SizeRequest result = new SizeRequest(new Size(MeasuredWidth, MeasuredHeight), new Size());
+                       var result = new SizeRequest(new Size(MeasuredWidth, MeasuredHeight), new Size());
+
+                       //Set Hint back after sizing
+                       Control.Hint = hint;
+
                        result.Minimum = new Size(Math.Min(Context.ToPixels(10), result.Request.Width), result.Request.Height);
 
                        // if the measure of the view has changed then trigger a request for layout