在这段代码中,我首先创建了reportpage 和about page。然后我创建了一个shell 页面并将这两个页面添加到标签栏。我在报告页面中有一个广告。现在我想在我的标签栏下面的 shell 中携带广告,任何方式都可以在下面显示广告Shell
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:local="clr-namespace:OZHealth.Views" xmlns:views1="clr-namespace:OZHealth.Models" xmlns:controls="clr-namespace:OZHealth.Controls"
Title="OZHealth"
x:Class="OZHealth.AppShell">
<Shell.Resources>
<ResourceDictionary>
<Color x:Key="NavigationPrimary">#2196F3</Color>
<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor" Value="{StaticResource NavigationPrimary}" />
<Setter Property="Shell.ForegroundColor" Value="White" />
<Setter Property="Shell.TitleColor" Value="White" />
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
<Setter Property="Shell.TabBarForegroundColor" Value="White"/>
<Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/>
<Setter Property="Shell.TabBarTitleColor" Value="White"/>
</Style>
<Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" />
</ResourceDictionary>
</Shell.Resources>
<TabBar>
<Tab Title="Browse" Icon="tab_feed.png">
<ShellContent ContentTemplate="{DataTemplate local:ItemsPage}" />
</Tab>
<Tab Title="Reports" Icon="tab_about.png">
<ShellContent ContentTemplate="{DataTemplate local:ReportsPage}" />
</Tab>
</TabBar>
</shell>
这是我的 ReportPage.one of item in tabbar
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="OZHealth.Views.ReportsPage"
xmlns:viewmodels="clr-namespace:OZHealth.ViewModels" xmlns:views="clr-namespace:OZHealth.Views" xmlns:views1="clr-namespace:OZHealth.Models" xmlns:controls="clr-namespace:OZHealth.Controls"
Title="{Binding Title}">
<ContentPage.BindingContext>
<viewmodels:ReportsViewModel />
</ContentPage.BindingContext>
<ContentPage.Resources>
</ContentPage.Resources>
<StackLayout Orientation="Vertical" Padding="16,40,16,40" Spacing="10">
<!--this is my chart-->
<views:PieChartView />
<!--this is my GoogleaAds-->
<views1:AdMobView x:Name="AdView" >
</views1:AdMobView>
</StackLayout>
</ContentPage>
这是我的壳牌页面
我想携带这样的外壳或应用程序的广告底部
如何将广告带到外壳底部?我无法NavBar
使用Shell