Android image scale problem?

DevinRoseDevinRose USMember ✭✭

When I scale an image, Android appears to shift that image (or scale it from a different anchor point than expected). My main use case is centering a logo horizontally on the screen, but Android will shift the image left if I scale it. If the image is not scaled (or scale = 1), the image is perfectly centered.

Here is example code for a Content page. If you uncomment out the Scale = 0.5; line you will see the image gets smaller but also moves left (and maybe up as well):

    public OtherPage ()
    {
        Title = "Other Page";

        BackgroundColor = Color.White;

        var logo = new Image () { 
            Source = "selectedicon.png",
            //Scale = 0.5,
            HorizontalOptions = LayoutOptions.Center
        };

        var stackLayout = new StackLayout () {
            Orientation = StackOrientation.Vertical,
            VerticalOptions = LayoutOptions.CenterAndExpand,
            HorizontalOptions = LayoutOptions.FillAndExpand,
            Children = { logo }
        };

        Content = stackLayout;

    }

Should I file a bug for this?

Answers

Sign In or Register to comment.