diff options
author | E.Z. Hart <hartez@users.noreply.github.com> | 2016-06-16 10:35:24 -0600 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-06-16 17:35:24 +0100 |
commit | 9df4d9c3285952d8ff3ff7940457f44f35a34f81 (patch) | |
tree | 23d83d152c0854b8462acfc6107430e602f2a49e /Xamarin.Forms.Controls.Issues | |
parent | 8dd51f2b49799bf7c0e51efe1d339dec44d91220 (diff) | |
download | xamarin-forms-9df4d9c3285952d8ff3ff7940457f44f35a34f81.tar.gz xamarin-forms-9df4d9c3285952d8ff3ff7940457f44f35a34f81.tar.bz2 xamarin-forms-9df4d9c3285952d8ff3ff7940457f44f35a34f81.zip |
Add repro of uncentered button image for Android (#176)
Fix vertical centering logic for button images in Android
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417.cs | 35 | ||||
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417Xaml.xaml | 18 |
2 files changed, 38 insertions, 15 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417.cs index 8edfb909..5ae2970f 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417.cs @@ -10,20 +10,40 @@ namespace Xamarin.Forms.Controls.Issues { protected override void Init() { - var instructions = new Label { Text = @"There should be 6 buttons below. -The first button should have the text 'Click Me' in the center. -The second button should have an image in the center and no text. -The third button should have the image on the left and the text on the right. -The fourth button should have the image on the top and the text on the bottom. -The fifth button should have the image on the right and the text on the left. -The sixth button should have the image on the bottom and the text on the top." }; + var instructions = new Label { Text = @"There should be 8 buttons below (the bottom 7 are in a ScrollView). +Buttons 1 and 2 have images which are horizontally and vertically centered. +Button 3 should have the text 'Click Me' in the center. +Button 4 should have an image in the center and no text. +Button 5 should have the image on the left and the text on the right. +Button 6 should have the image on the top and the text on the bottom. +Button 7 should have the image on the bottom and the text on the top. +Button 8 have the image on the right and the text on the left." }; + + var grid = new Grid + { + RowDefinitions = new RowDefinitionCollection + { + new RowDefinition { Height = 100 } + }, + VerticalOptions = LayoutOptions.Start, + Children = + { + new Button + { + HeightRequest = 500, // Making sure that the image still gets centered vertically even if the HeightRequest won't be honored + Image = "coffee.png" + } + } + }; Content = new StackLayout { + VerticalOptions = LayoutOptions.Fill, Spacing = 10, Children = { instructions, + grid, new ScrollView { Content = new StackLayout @@ -33,6 +53,7 @@ The sixth button should have the image on the bottom and the text on the top." } HorizontalOptions = LayoutOptions.Center, Children = { + new Button { WidthRequest = 200, HeightRequest = 300, Image = "coffee.png" }, new Button { Text = "Click Me", BackgroundColor = Color.Gray }, new Button { Image = "coffee.png", BackgroundColor = Color.Gray }, CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Left, 10)), diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417Xaml.xaml b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417Xaml.xaml index d050524e..72442038 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417Xaml.xaml +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417Xaml.xaml @@ -2,14 +2,16 @@ <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Xamarin.Forms.Controls.Issues.Bugzilla27417Xaml"> - <StackLayout Spacing="10" HorizontalOptions="Center" > + <StackLayout Spacing="10"> - <Button BackgroundColor="Color.Gray" Text="Click Me"></Button> - <Button BackgroundColor="Color.Gray" Image="coffee.png"></Button> - <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me"></Button> - <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Top,10"></Button> - <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Bottom,10"></Button> - <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Right"></Button> + <Button BackgroundColor="Color.Gray" Text="Click Me"></Button> + <Button BackgroundColor="Color.Gray" Image="coffee.png"></Button> + <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me"></Button> + <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Top,10"></Button> + <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Bottom,10"></Button> + <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Right"></Button> - </StackLayout> + <Button HeightRequest="125" WidthRequest="200" BackgroundColor="Lime" Image="coffee.png" HorizontalOptions="Center" VerticalOptions="Center"/> + + </StackLayout> </ContentPage>
\ No newline at end of file |