Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何限制Xamarin中栅格的高度?_Xamarin_Xamarin.forms - Fatal编程技术网

如何限制Xamarin中栅格的高度?

如何限制Xamarin中栅格的高度?,xamarin,xamarin.forms,Xamarin,Xamarin.forms,我在XAML中有: <Grid.RowDefinitions> <RowDefinition Height="8*" /> <RowDefinition Height="83*" /> <RowDefinition Height="8*" /> <RowDefinition Height="1*" /> <

我在XAML中有:

        <Grid.RowDefinitions>
            <RowDefinition Height="8*" />
            <RowDefinition Height="83*" />
            <RowDefinition Height="8*" />
            <RowDefinition Height="1*" />
        </Grid.RowDefinitions>

        <Grid Grid.Row="3" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="#EEEEEE" RowSpacing="0" Padding="0">
            <Grid x:Name="a">
                <local:TimerView x:Name="timerView1" VerticalOptions="FillAndExpand">
                    <local:TimerView.ProgressBar>
                        <Frame HasShadow="false" Padding="0" Margin="0" BackgroundColor="#AAAAAA" CornerRadius="0" VerticalOptions="FillAndExpand" />
                    </local:TimerView.ProgressBar>
                    <local:TimerView.TrackBar>
                        <Frame HasShadow="false" Padding="0" Margin="0" CornerRadius="0" BackgroundColor="#EEEEEE" VerticalOptions="FillAndExpand" />
                    </local:TimerView.TrackBar>
                </local:TimerView>
            </Grid>
        </Grid>

我希望网格的高度.Row=“3”非常小,可能是2-3px。有没有办法将高度限制在这么小的范围内?


<Grid.RowDefinitions>
            <RowDefinition Height="8*" />
            <RowDefinition Height="83*" />
            <RowDefinition Height="8*" />
            <RowDefinition Height="3" /> // ---> The number 3 row (don't put any *)
</Grid.RowDefinitions>
...
//-->第3行(不要放任何*) ...
当您输入“3”左右(不带*)时,值以DPI为单位

请注意,如果不“使用”该行显示任何内容,则可以使用网格上的边距属性。即:

<Grid Margin="0,0,0,3"> // --> Sets a 3DPI margin at bottom
    <Grid.RowDefinitions>
            <RowDefinition Height="8*" />
            <RowDefinition Height="83*" />
            <RowDefinition Height="8*" />
    </Grid.RowDefinitions>
    ...
/-->在底部设置3DPI边距
...

DPI是一种很好的方法,这样在不同的手机上看起来都一样吗?我最初考虑的是像素,但不确定如何使用手机/iPad和所有可以使用的不同显示器。我只知道我需要一个小的网格高度。是的!它们是由每个平台独立识别的设备独立单元。顺便说一下,你可以得到更多的信息