This commit is contained in:
ShaneN 2019-06-30 10:02:55 -06:00
Родитель 12bebc5096 ca1e3fd3b8
Коммит 97a558a252
1 изменённых файлов: 17 добавлений и 4 удалений

Просмотреть файл

@ -82,8 +82,21 @@ namespace Xamarin.Forms.Platform.Android
internal SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint) internal SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint)
{ {
var previousHeight = View.MeasuredHeight;
var previousWidth = View.MeasuredWidth;
View.Measure(widthConstraint, heightConstraint); View.Measure(widthConstraint, heightConstraint);
// if the measure of the view has changed then trigger a request for layout
// if the measure hasn't changed then force a layout of the button
if (previousHeight != View.MeasuredHeight || previousWidth != View.MeasuredWidth)
{
if (!View.IsLayoutRequested)
View.RequestLayout();
}
else
View.ForceLayout(); View.ForceLayout();
return new SizeRequest(new Size(View.MeasuredWidth, View.MeasuredHeight), Size.Zero); return new SizeRequest(new Size(View.MeasuredWidth, View.MeasuredHeight), Size.Zero);
} }