微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用 Xamarin.iOS 将广告内容分配给 stacklayout

如何解决如何使用 Xamarin.iOS 将广告内容分配给 stacklayout

我想将横幅内容分配到 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 } 移动到我的新堆栈布局中?

解决方法

将其添加到现有的 StackLayout

Advertising.Children.Add(admobControl);

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。