* Tryed to reproduce the same correction applied to the default implementation * Added repro sample * Fixed build error on iOS
This commit is contained in:
Родитель
eb4ae0741d
Коммит
24bb5bb1ec
|
@ -0,0 +1,65 @@
|
|||
using Xamarin.Forms.Internals;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
|
||||
#if UITEST
|
||||
using Xamarin.Forms.Core.UITests;
|
||||
using Xamarin.UITest;
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
#if UITEST
|
||||
[Category(UITestCategories.Button)]
|
||||
#endif
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 7875, "Button size changes when setting Accessibility properties", PlatformAffected.Android)]
|
||||
public class Issue7875 : TestContentPage
|
||||
{
|
||||
public Issue7875()
|
||||
{
|
||||
Title = "Issue 7875";
|
||||
|
||||
var layout = new Grid();
|
||||
|
||||
layout.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
||||
layout.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
||||
layout.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
||||
|
||||
var instructions = new Label
|
||||
{
|
||||
BackgroundColor = Color.Black,
|
||||
TextColor = Color.White,
|
||||
Text = "If the buttons below have the same size, the test has passed."
|
||||
};
|
||||
layout.Children.Add(instructions, 0, 0);
|
||||
|
||||
var button = new Button
|
||||
{
|
||||
BackgroundColor = Color.Gray,
|
||||
HorizontalOptions = LayoutOptions.Center,
|
||||
ImageSource = "calculator.png",
|
||||
Text = "Text"
|
||||
};
|
||||
layout.Children.Add(button, 0, 1);
|
||||
|
||||
var accesibilityButton = new Button
|
||||
{
|
||||
BackgroundColor = Color.Gray,
|
||||
HorizontalOptions = LayoutOptions.Center,
|
||||
ImageSource = "calculator.png",
|
||||
Text = "Text"
|
||||
};
|
||||
accesibilityButton.SetValue(AutomationProperties.NameProperty, "AccesibilityButton");
|
||||
accesibilityButton.SetValue(AutomationProperties.HelpTextProperty, "Help Large Text");
|
||||
layout.Children.Add(accesibilityButton, 0, 2);
|
||||
|
||||
Content = layout;
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1181,6 +1181,7 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)Issue8672.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue8326.xaml.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue8449.xaml.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue7875.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla22229.xaml">
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace Xamarin.Forms.Platform.Android.FastRenderers
|
|||
return false;
|
||||
}
|
||||
|
||||
if (Element is Picker)
|
||||
if (Element is Picker || Element is Button)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -82,10 +82,26 @@ namespace Xamarin.Forms.Platform.Android.FastRenderers
|
|||
{
|
||||
((IElementController)Button).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, hasFocus);
|
||||
}
|
||||
|
||||
|
||||
SizeRequest IVisualElementRenderer.GetDesiredSize(int widthConstraint, int heightConstraint)
|
||||
{
|
||||
return _buttonLayoutManager.GetDesiredSize(widthConstraint, heightConstraint);
|
||||
if (_isDisposed)
|
||||
{
|
||||
return new SizeRequest();
|
||||
}
|
||||
|
||||
var hint = Control.Hint;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(hint))
|
||||
{
|
||||
Control.Hint = string.Empty;
|
||||
}
|
||||
|
||||
var result = _buttonLayoutManager.GetDesiredSize(widthConstraint, heightConstraint);
|
||||
|
||||
Control.Hint = hint;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void IVisualElementRenderer.SetElement(VisualElement element)
|
||||
|
|
Загрузка…
Ссылка в новой задаче