You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xamarin Shell FlyoutPage底部标签栏遮挡内容页底部区域问题求助

Hey Ricardo, let's tackle your two issues one by one:

1. Fixing Content Being Obscured by the Bottom Tab Bar

Since you want a fixed page (no ScrollView) that fits entirely above the tab bar, the cleanest and most reliable solution is to use Xamarin.Forms' built-in safe area support. Here's how:

  • Add the UseSafeArea="True" attribute directly to your ContentPage tag. This automatically adjusts your page layout to avoid system UI (like status bars) and Shell's tab bar across all platforms—no manual margin/padding calculations required.

Your modified OffersPage XAML will look like this:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
             xmlns:local="clr-namespace:EY365OCMobileApp" 
             x:Class="EY365OCMobileApp.OffersPage" 
             ControlTemplate="{StaticResource SpeechBotIconTemplate}" 
             Title="Offerings" 
             BackgroundColor="white" 
             Shell.TitleColor="Black"
             UseSafeArea="True"> <!-- This line fixes the tab bar overlap -->
<!-- Rest of your page content remains unchanged -->
</ContentPage>

If you prefer not to use safe areas for some reason, you can also set platform-specific padding on your root StackLayout:

<StackLayout Padding="{OnPlatform iOS='0,0,0,60', Android='0,0,0,50', UWP='0,0,0,0'}">

But UseSafeArea is the better choice as it adapts automatically to different device sizes and OS versions.

2. Fixing the TitleColor Not Working

Looking at your OffersPage code, you currently have Shell.TitleColor="white" set—that's why it's displaying white instead of black! If you intended to use a black title, just update that value to Black:

Shell.TitleColor="Black"

If you still see issues after this change, it might be a caching quirk. Try cleaning your solution and rebuilding. Alternatively, you can set the title color directly on the corresponding ShellContent in your AppShell.xaml to ensure it overrides the global setting:

<ShellContent Title="Offerings" 
              Icon="{local:ImageResource EY365OCMobileApp.Images.offeringsicon.png}" 
              ContentTemplate="{DataTemplate local:OffersPage}"
              Shell.TitleColor="Black"/> <!-- Explicitly set title color here -->

That should resolve both of your problems!

内容的提问来源于stack exchange,提问作者Ricardo Jahn

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.28 13:42:35