Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin.Forms layout equivalent to FrameLayout

Just a beginner question about what is the equivalent to FrameLayout (Android) in Xamarin.Forms?

like image 791
Khiem-Kim Ho Xuan Avatar asked Oct 26 '15 07:10

Khiem-Kim Ho Xuan


1 Answers

FrameLayout is a control that is designed to contain a single child but can optionally have multiple children that are controlled with gravity or what works similar to zindex.

I don't think there is a direct map from xamarin.Forms to Framelayout.

if your just looking for a page level container for a single control there is:

  • Frame-An element containing a single child, with some framing options. Frame have a default Xamarin.Forms.Layout.Padding of 20.
  • ScrollView-An element capable of scrolling if it's Content requires.

If your looking for a Multiple Item Container the options are:

  • Grid -A layout containing views arranged in rows and columns.
  • RelativeLayout -A Layout that uses Constraints to layout its children.
  • StackLayout - A Layout that positions child elements in a single line which can be oriented vertically or horizontally. This layout will set the child bounds automatically during a layout cycle. User assigned bounds will be overwritten and thus should not be set on a child element by the user.

see:https://developer.xamarin.com/guides/cross-platform/xamarin-forms/controls/layouts/

However none of these support the Z-Index like ability of FrameLayout the best option at the moment is a Grid with a single element. The children will layout from back to front in the order they are in the Grids.Children stack.

like image 149
David Avatar answered Oct 11 '22 09:10

David