水平布局选项“StartAndExpand”和Vertical FillAndExpand

时间:2015-11-03 11:17:42

标签: xamarin xamarin.forms

我有这张图片:

var logoImage = new Image () 
{ 
    HorizontalOptions = LayoutOptions.StartAndExpand,  
    VerticalOptions = LayoutOptions.FillAndExpand, 
    Aspect = Aspect.AspectFit
};

但它没有垂直拉伸。结果在此处:Image

如果我删除了Horizo​​ntalOptions,那么一切都会好起来的。但是,图像将居中,但我需要左侧。

P.S。图像位于网格中。

   public class TopMenu:Grid
    {
        public TopMenu ()
        {
            this.HeightRequest = 40;
            this.Padding = 0;

            this.BackgroundColor = Color.FromRgb (255, 146, 0);

        var logoImage = new Image () { Source = ImageSource.FromResource ("***.Images.TopMenu.logo_new.gif"),  
        HorizontalOptions = LayoutOptions.StartAndExpand,  
        VerticalOptions = LayoutOptions.FillAndExpand, 
        Aspect = Aspect.AspectFit };

            this.Children.Add (logoImage);
        }
    }

0 个答案:

没有答案