【问题标题】:How to assign ad content to stacklayout using Xamarin.iOS如何使用 Xamarin.iOS 将广告内容分配给 stacklayout
【发布时间】:2021-06-24 17:30:33
【问题描述】:

我想将横幅内容分配到 stacklayout。在我的 MainPage.xaml 中,我使用 x:Name="Advertising" 创建了一个新的堆栈布局。

<StackLayout x:Name="Advertising">

    </StackLayout>

现在我想将横幅中的内容直接移动到 stacklayout 中。我的 MainPage.xaml.cs 中的 c# 代码是:

AdmobControl admobControl = new AdmobControl()
        {
            AdUnitId = AppConstants.BannerId
        };
        

        Content = new StackLayout()
        {
            Children = { admobControl }
        };

如何使用 x:Name="Advertising" 将内容 Children = { admobControl } 移动到我的新堆栈布局中?

【问题讨论】:

    标签: c# ios xamarin mobile admob


    【解决方案1】:

    将其添加到现有的StackLayout

    Advertising.Children.Add(admobControl);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-01
      • 2012-06-21
      • 1970-01-01
      • 1970-01-01
      • 2016-05-01
      • 2019-01-18
      • 2017-04-13
      相关资源
      最近更新 更多