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
Xaml 将stacklayout放置在屏幕中央_Xaml_Xamarin_Xamarin.forms_Cross Platform - Fatal编程技术网

Xaml 将stacklayout放置在屏幕中央

Xaml 将stacklayout放置在屏幕中央,xaml,xamarin,xamarin.forms,cross-platform,Xaml,Xamarin,Xamarin.forms,Cross Platform,我尝试将horizontaloptions=“CenterAndExpand”代码插入所有stacklayout路径,但没有成功 它仍然在左上角:( 有人知道吗?我实际上不使用网格,我只是把它放在那里了 我的代码: 这是因为您的堆栈布局默认值是填充和展开 要在网格中居中,请将其设置为堆栈布局的水平选项=“中心”垂直选项=“中心”当您在空布局中定义CenterAndExpand时,它的行为类似于FillAndExpand,可以这样展开:-它从“中心”开始,然后“展开”对于可用空间-,这意味着如果可

我尝试将horizontaloptions=“CenterAndExpand”代码插入所有stacklayout路径,但没有成功

它仍然在左上角:( 有人知道吗?我实际上不使用网格,我只是把它放在那里了

我的代码:


这是因为您的
堆栈布局
默认值是
填充和展开


要在
网格中居中,请将其设置为
堆栈布局
水平选项=“中心”垂直选项=“中心”

当您在空布局中定义CenterAndExpand时,它的行为类似于FillAndExpand,可以这样展开:-它从“中心”开始,然后“展开”对于可用空间-,这意味着如果可用空间是从上到下的,它将填充所有空间,请尝试将网格仅置于中心,内部堆栈也置于中心