Reputation: 5615
I recently had a discussion with my team about Xamarin.Form layouts, and they thought Xamarin.Forms.AbsoluteLayout was brittle and hard to work with (personally I think they are very handy especially for proportional layouts, and from everything I remember reading, they are generally not a performance issue). They referenced this article, which said to avoid using AbsoluteLayouts -- but that was an Android-specific article, and it was referring to Android.Widget.AbsoluteLayout.
So that got me to thinking...does Xamarin.Forms.Layout somehow translate into Android.Widget.AbsoluteLayout (I think they're completely different since Xamarin.Forms allows proportional sizing/position)? How does Xamarin.Forms translate various layouts into platform-specific layouts?
Upvotes: 4
Views: 237
Reputation: 9153
Layouts work different in Xamarin Forms than their equivalents on the native platform. The XF Absolute Layout is not just a wrapper around the Android AbsoluteLayout.
Layouts in XF are similar to how they work in WPF and other Microsoft Platforms. The Layout first asks all its children to give it a preferred size (Measure). Then it uses its logic to arrange its children. The built-in controls wrap existing native controls (e.g. Entry maps to UITextBox on iOS and EditText on Android).
That being said. I agree that Absolute Layouts in general are not a good approach for supporting multiple screen sizes. There are other more flexible layouts that help you create a general approach to a "universal" UI.
Upvotes: 3