locked
Android image scale problem? RRS feed

  • Question

  • User64161 posted

    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?

    Tuesday, August 26, 2014 6:20 PM

All replies

  • User57057 posted

    +1 - Also experiencing this problem!

    Wednesday, August 27, 2014 3:34 PM
  • User64161 posted

    Xamarin confirmed this is a (regression) bug and filed a bug on it: https://bugzilla.xamarin.com/show_bug.cgi?id=22412

    Wednesday, August 27, 2014 4:49 PM