Absolute Layout
AbsoluteLayout
allows explicit positioning of the child components using explicit values. The positions are defined from the top left corner of the layout and can be set using the View.Positions
property.
You can scroll this table.
Property | Type | Description |
---|---|---|
Position |
float, float, float | Sets the position of the component in the layout. |
Position2D |
int, int | Sets the position of the component in the layout for X and Y axis. |
PositionX |
float | Sets the position of the component in the layout X axis. |
PositionY |
float | Sets the position of the component in the layout Y axis. |
Position views with absolute layout
The following example shows how to use position views with the AbsoluteLayout
:
C#
Copy
View absoluteLayoutView = new View
{
WidthSpecification = LayoutParamPolicies.MatchParent,
HeightSpecification = LayoutParamPolicies.MatchParent,
BackgroundColor = Color.White,
};
absoluteLayoutView.Layout = new AbsoluteLayout();
TextLabel header = new TextLabel
{
Text = "Stylish Header",
PointSize = 25,
Position2D = new Position2D(290, 270)
};
View redView = new View
{
BackgroundColor = Color.Red,
Position2D = new Position2D(232, 208),
WidthSpecification = 800,
HeightSpecification = 5
};
View greenView = new View
{
BackgroundColor = Color.Green,
Position2D = new Position2D(232, 220),
WidthSpecification = 800,
HeightSpecification = 5
};
View blueView = new View
{
BackgroundColor = Color.Blue,
Position2D = new Position2D(242, 200),
WidthSpecification = 5,
HeightSpecification = 400
};
View magentaView = new View
{
BackgroundColor = Color.Magenta,
Position2D = new Position2D(254, 200),
WidthSpecification = 5,
HeightSpecification = 400
};
absoluteLayoutView.Add(header);
absoluteLayoutView.Add(redView);
absoluteLayoutView.Add(greenView);
absoluteLayoutView.Add(blueView);
absoluteLayoutView.Add(magentaView);
You can scroll this table.
protobuf
Copy
<View
WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
HeightSpecification="{Static LayoutParamPolicies.MatchParent"
BackgroundColor="White">
<View.Layout>
<AbsoluteLayout />
</View.Layout>
<TextLabel
Text="Stylish Header"
PointSize="25"
Position2D="290,270"/>
<View
BackgroundColor="Red"
Position2D="232,208"
WidthSpecification="800"
HeightSpecification="5"/>
<View
BackgroundColor="Green"
Position2D="232,220"
WidthSpecification="800"
HeightSpecification="5"/>
<View
BackgroundColor="Blue"
Position2D="242,200"
WidthSpecification="5"
HeightSpecification="400"/>
<View
BackgroundColor="Magenta"
Position2D="254,200"
WidthSpecification="5"
HeightSpecification="400"/>
</View>
You can scroll this table.
Related information
- Dependencies
- Tizen 6.5 and Higher
Submit your feedback to GitHub