Reputation: 4586
I came across a xamarin axml code where they use nested gridview to achieve a simple UI like the image below. Is it really necessary to use nested gridviews to achieve this page. I read somewhere using relative layout are expensive in xamarin forms application. Is there someway to actually effectively create this UI in xamarin axml. I dont have any experience in xamarin forms as i have worked in android{native} there using relative is more recommended.
Upvotes: 0
Views: 591
Reputation: 67178
There are often many, many ways to get a desired UI with different layouts. A Relative Layout is, generally speaking, slower than most because relative measurements must be done by the layout system for many properties of all elements in the layout. A Grid typically requires less measurement.
Is this a problem? It would depend on the number of elements, the complexity, styling, triggers and a load of other things. Basically it's a case-by-case basis. I suspect for something simple like what you see above a Relative Layout would be not noticeably different from a Grid Layout or an Absolute Layout.
Often the layout used boils down to the style preference of the author and really has no other "meaning" to it. What you show above could probably be done with simple Stack Layouts as well.
I will say that it's pretty rare to end up using only one type of Layout on a given screen. You will find that you usually end up nesting (unless you're a fan of the Absolute Layout I suppose).
Upvotes: 2