【问题标题】:I want draw image in two row in Xamarin我想在 Xamarin 的两行中绘制图像
【发布时间】:2017-03-24 06:30:12
【问题描述】:

我在 VS2015 中为 android 制作应用程序。 我想做一个像上图一样的网格布局。

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="30*" />
        <ColumnDefinition Width="70*" />
    </Grid.ColumnDefinitions>
    <Image x:Name="BackImage" Source="{Binding ImageName}" Grid.Column="0"/>
    <Grid.RowDefinitions>
            <RowDefinition Height="50*"/>
            <RowDefinition Height="50*"/>
        </Grid.RowDefinitions>              

        <Grid Grid.Column="1" Grid.Row="0">
        <Label Text="Text1"/>
        </Grid>
        <Grid Grid.Column="1" Grid.Row="1">
        <Label Text="Text2"/>
        </Grid>
    </Grid>

我在划分行之前绘制图像。 但是图像只像这样在第 0 行绘制。 我想像 1 行一样使用第 0 行和第 1 行。

【问题讨论】:

  • 请内联您的图片,而不是链接到它们。

标签: android xamarin visual-studio-2015 grid xamarin.forms


【解决方案1】:

你要找的是这个:

<Image x:Name="BackImage" Source="{Binding ImageName}" Grid.Column="0" Grid.RowSpan="2"/>

RowSpanColumnSpan 指示 Grid 布局系统您希望对象跨越多行或多列。

RowDefinitions 之前声明图像不会改变任何内容。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-28
    • 2019-09-14
    • 2019-09-11
    • 2014-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多