c# - 如何使用 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 }
};
如何Children = { admobControl }
使用 x:Name="Advertising" 将内容移动到我的新堆栈布局中?
解决方案
将其添加到现有的StackLayout
Advertising.Children.Add(admobControl);
推荐阅读
- amazon-web-services - Kubernetes Ingress-Controller 和 AWS API Gateway 客户端证书
- firebase - 如何在 Angular 6 应用程序中将 algolia 与实时数据库 firebase 集成。
- php - 返回 Post Slug
- sql - 合并加入未按记录的 Redshift 工作
- excel - 行中具有多个平均值的 Excel 数据透视表
- sql-server - 将 SQL Server 列中的 XML 转换为文本
- php - Symfony LockableTrait - 错误/超时后解锁
- sql - 避免在 MATLAB 代码中编写 SQL 语句
- css - Sass parent selector interpolation
- css - 如何在容器的 100% 处 CSS 一条垂直线