use*_*474 4 grid layout xamarin xamarin.forms
有人可以解释Xamarin.Forms中的GridLayout引用吗?
使用FormsGallery上的示例,这里也可以看到http://iosapi.xamarin.com/?link=T%3aXamarin.Forms.Grid(也有图像)我试图解决它,但我的试验和错误没有非常成功,非常耗时.
查看网格的第一行,代码如下
grid.Children.Add(new Label
{
Text = "Grid",
Font = Font.BoldSystemFontOfSize(50),
HorizontalOptions = LayoutOptions.Center
}, 0, 3, 0, 1);
Run Code Online (Sandbox Code Playgroud)
它看起来好像第一个0表示X位置,3表示列跨度,下一个0表示y位置,一个表示行跨度.但是使用它作为参考并尝试添加其他行和列它不起作用.如果他们的样本包含一些评论会很棒,但是因为他们不能告诉我GridLayout引用如何工作?
干杯
我实际上发现Miha Markic的答案有点误导,不是因为他给出的答案是错误的,而是因为Xamarin对这些论点所做的事情并不清楚.
Add(View view, int left, int right, int top, int bottom)
left = column,
right = used to work out column span ie. right - left
top = row,
bottom = used to work out row span ie. bottom - top
Run Code Online (Sandbox Code Playgroud)
这意味着如果您希望第二列中的项目跨越两个,则必须执行以下操作:
Add(view, 1, 3, 0, 1)
Run Code Online (Sandbox Code Playgroud)
这有点奇怪,因为你需要放3才能跨越两列.
(我最初在xamarin论坛上找到答案)
| 归档时间: |
|
| 查看次数: |
10891 次 |
| 最近记录: |