Skip to content

Commit 1fc5b71

Browse files
Copilothaavamoa
andcommitted
Fix iOS UIToolbar system appearance and Android vertical centering
Co-authored-by: haavamoa <2527084+haavamoa@users.noreply.github.com>
1 parent a4318d9 commit 1fc5b71

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/library/DIPS.Mobile.UI/Components/Toolbar/Android/ToolbarHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ protected override LinearLayout CreatePlatformView()
3131
border.SetBackgroundColor(Resources.Colors.Colors.GetColor(ColorName.color_border_default).ToPlatform());
3232
outer.AddView(border, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, borderPx));
3333

34-
// Buttons row: fills remaining space, centers buttons vertically (M3 spec: icons vertically centered in 80dp bar)
34+
// Buttons row: fills remaining space with weight=1, centers buttons vertically
3535
m_buttonsLayout = new LinearLayout(Context)
3636
{
3737
Orientation = Orientation.Horizontal,
38-
// Gravity = GravityFlags.CenterVertical, //Didnt work
3938
};
40-
outer.AddView(m_buttonsLayout, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
39+
m_buttonsLayout.SetGravity(GravityFlags.CenterVertical);
40+
outer.AddView(m_buttonsLayout, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 0, 1f));
4141

4242
return outer;
4343
}

src/library/DIPS.Mobile.UI/Components/Toolbar/iOS/ToolbarHandler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public partial class ToolbarHandler : ViewHandler<Toolbar, UIToolbar>
99
{
1010
protected override UIToolbar CreatePlatformView()
1111
{
12-
var toolbar = new UIToolbar();
13-
toolbar.BarTintColor = Resources.Colors.Colors.GetColor(ColorName.color_surface_default).ToPlatform();
14-
toolbar.Translucent = false;
15-
return toolbar;
12+
// Use the default UIToolbar system appearance — do NOT set BarTintColor or Translucent = false,
13+
// as that overrides the system-provided translucent material (Liquid Glass on iOS 26+,
14+
// blurred translucent bar on earlier versions).
15+
return new UIToolbar();
1616
}
1717

1818
protected override void ConnectHandler(UIToolbar platformView)

0 commit comments

Comments
 (0)