Xamarin.Forms UI 坐标系 [英] Xamarin.Forms UI Coordinate System

查看:40
本文介绍了Xamarin.Forms UI 坐标系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不确定这是否是问这个问题的正确地方.我也不确定我是否只是不擅长互联网,但我无法找到有关 Xamarin 的 UI 坐标系统的任何权威文档.我可以说 (0, 0) 是左上角.然而,UI 对象的原点是在中心吗?是在左上角吗?左中?该系统显然不是以像素为单位的.绝对位置分辨率是否独立?

Not sure if this is the right place to be asking this. I'm also not sure if I'm just bad at the internet, but I haven't been able to find any definitive documentation on Xamarin's UI Coordinate System. I can tell that (0, 0) is top left. However, is the origin for UI objects in the center? Is it on the top left; middle left? The system is obviously not gauged in pixels. Are absolute positions resolution independent?

如果有人知道这个文档/可以给我详细解释它是如何工作的,我将永远感激.

If any one knows of this documentation / can give me a detailed explanation of how this works I would be eternally grateful.

提前致谢!

推荐答案

所有尺寸都从其父级的左上角开始计算.根父级是 Page.

All sizes all calculated from top left of their parent. The root parent is Page.

事物的定位方式也取决于 LayoutOptions (https://stackoverflow.com/a/25338534/5064986)

How things are positioned also depends of LayoutOptions (https://stackoverflow.com/a/25338534/5064986)

Xamarin.Forms 的理念是使用尽可能多的底层平台.按照这个哲学,Xamarin.Forms 程序员使用定义的大小每个特定的平台.程序员遇到的所有尺寸通过 Xamarin.Forms API 在这些特定于平台的与设备无关的单元.

Xamarin.Forms has a philosophy of using the conventions of the underlying platforms as much as possible. In accordance with this philosophy, the Xamarin.Forms programmer works with sizes defined by each particular platform. All sizes that the programmer encounters through the Xamarin.Forms API are in these platform-specific device-independent units.

这将是 iOS 中的点"和 Android 中的dpi".

That would be "points" in iOS and "dpi" on Android.

有一整本书关于它的章节(免费)https://download.xamarin.com/developer/xamarin-forms-book/BookPreview2-Ch05-Rel0203.pdf

There's a whole book chapter about it (free) https://download.xamarin.com/developer/xamarin-forms-book/BookPreview2-Ch05-Rel0203.pdf

这篇关于Xamarin.Forms UI 坐标系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆