appBar.Position2D = new Position2D(appBarPosX, appBarPosY);
- // FIXME: Now, WidthSpecification/HeightSpecification are updated internally.
- // When this is resolved, comparing Specification with Size is removed.
- if ((appBar.WidthSpecification == LayoutParamPolicies.MatchParent) || (appBar.HeightSpecification == LayoutParamPolicies.MatchParent) ||
- (appBar.WidthSpecification > Size2D.Width) || (appBar.HeightSpecification > Size2D.Height))
+ if ((appBar.WidthSpecification == LayoutParamPolicies.MatchParent) || (appBar.HeightSpecification == LayoutParamPolicies.MatchParent))
{
int appBarSizeW = appBar.Size2D.Width;
int appBarSizeH = appBar.Size2D.Height;
- if ((appBar.WidthSpecification == LayoutParamPolicies.MatchParent) || (appBar.WidthSpecification > Size2D.Width))
+ if (appBar.WidthSpecification == LayoutParamPolicies.MatchParent)
{
appBarSizeW = Size2D.Width - Padding.Start - Padding.End - appBar.Margin.Start - appBar.Margin.End;
}
- if ((appBar.HeightSpecification == LayoutParamPolicies.MatchParent) || (appBar.HeightSpecification > Size2D.Height))
+ if (appBar.HeightSpecification == LayoutParamPolicies.MatchParent)
{
appBarSizeH = Size2D.Height - Padding.Top - Padding.Bottom - appBar.Margin.Top - appBar.Margin.Bottom;
}
content.Position2D = new Position2D(contentPosX, contentPosY);
- // FIXME: Now, WidthSpecification/HeightSpecification are updated internally.
- // When this is resolved, comparing Specification with Size is removed.
- if ((content.WidthSpecification == LayoutParamPolicies.MatchParent) || (content.HeightSpecification == LayoutParamPolicies.MatchParent) ||
- (content.WidthSpecification > Size2D.Width) || (content.HeightSpecification > Size2D.Height))
+ if ((content.WidthSpecification == LayoutParamPolicies.MatchParent) || (content.HeightSpecification == LayoutParamPolicies.MatchParent))
{
int contentSizeW = content.Size2D.Width;
int contentSizeH = content.Size2D.Height;
/// <since_tizen> 9 </since_tizen>
public TabView()
{
- // FIXME: Now, WidthSpecification/HeightSpecification are updated internally.
- // When this is resolved, LinearLayout can be used.
- Layout = new AbsoluteLayout();
+ Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical };
WidthSpecification = LayoutParamPolicies.MatchParent;
HeightSpecification = LayoutParamPolicies.MatchParent;
- InitContent();
InitTabBar();
-
- CalculatePosition();
+ InitContent();
}
private void InitTabBar()
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
- public override void OnRelayout(Vector2 size, RelayoutContainer container)
- {
- base.OnRelayout(size, container);
-
- CalculatePosition();
- }
-
- /// <inheritdoc/>
- [EditorBrowsable(EditorBrowsableState.Never)]
protected override void Dispose(DisposeTypes type)
{
if (disposed)
base.Dispose(type);
}
-
- private void CalculatePosition()
- {
- // If TabView size has not been set yet, then content size cannot be calculated.
- if ((Size2D.Width == 0) && (Size2D.Height == 0))
- {
- return;
- }
-
- if (tabBar != null)
- {
- // FIXME: Now, WidthSpecification/HeightSpecification are updated internally.
- // When this is resolved, comparing Specification with Size is removed.
- if ((tabBar.WidthSpecification == LayoutParamPolicies.MatchParent) || (tabBar.HeightSpecification == LayoutParamPolicies.MatchParent) ||
- (tabBar.WidthSpecification > Size.Width) || (tabBar.HeightSpecification > Size.Height))
- {
- int tabBarSizeW = tabBar.Size2D.Width;
- int tabBarSizeH = tabBar.Size2D.Height;
-
- if ((tabBar.WidthSpecification == LayoutParamPolicies.MatchParent) || (tabBar.WidthSpecification > Size.Width))
- {
- tabBarSizeW = Size2D.Width - Padding.Start - Padding.End - tabBar.Margin.Start - tabBar.Margin.End;
- }
-
- if ((tabBar.HeightSpecification == LayoutParamPolicies.MatchParent) || (tabBar.HeightSpecification > Size.Height))
- {
- tabBarSizeH = Size2D.Height - Padding.Top - Padding.Bottom - tabBar.Margin.Top - tabBar.Margin.Bottom;
- }
-
- tabBar.Size2D = new Size2D(tabBarSizeW, tabBarSizeH);
- }
- }
-
- if (content != null)
- {
- int contentPosX = Padding.Start + content.Margin.Start;
- int contentPosY = Padding.Top + content.Margin.Top;
-
- content.Position = new Position(contentPosX, contentPosY);
-
- // FIXME: Now, WidthSpecification/HeightSpecification are updated internally.
- // When this is resolved, comparing Specification with Size is removed.
- if ((content.WidthSpecification == LayoutParamPolicies.MatchParent) || (content.HeightSpecification == LayoutParamPolicies.MatchParent) ||
- (content.WidthSpecification > Size.Width) || (content.HeightSpecification > Size.Height))
- {
- int contentSizeW = content.Size2D.Width;
- int contentSizeH = content.Size2D.Height;
-
- if ((content.WidthSpecification == LayoutParamPolicies.MatchParent) || (content.WidthSpecification > Size.Width))
- {
- contentSizeW = Size2D.Width - Padding.Start - Padding.End - content.Margin.Start - content.Margin.End;
- }
-
- if ((content.HeightSpecification == LayoutParamPolicies.MatchParent) || (content.HeightSpecification > Size.Height))
- {
- contentSizeH = Size2D.Height - Padding.Top - Padding.Bottom - content.Margin.Top - content.Margin.Bottom - (tabBar?.Size2D.Height ?? 0);
- }
-
- content.Size2D = new Size2D(contentSizeW, contentSizeH);
- }
- }
-
- if (tabBar != null)
- {
- int tabBarPosX = Padding.Start + tabBar.Margin.Start;
- int tabBarPosY = /*Padding.Top +*/ tabBar.Margin.Top + (content?.Size2D.Height ?? 0);
-
- tabBar.Position = new Position(tabBarPosX, tabBarPosY);
- }
- }
}
}