我正在使用firebase_admob插件在 flutter 应用程序中设置广告。我尝试了横幅广告,它工作正常,但是,当我导航到另一个页面时,它仍然保持在原来的位置。我希望在导航到另一个页面时该广告应该隐藏。
代码片段如下。
BannerAd myBanner = BannerAd(
// Replace the testAdUnitId with an ad unit id from the AdMob dash.
// https://developers.google.com/admob/android/test-ads
// https://developers.google.com/admob/ios/test-ads
adUnitId: BannerAd.testAdUnitId,
size: AdSize.smartBanner,
targetingInfo: targetingInfo,
listener: (MobileAdEvent event) {
print("BannerAd event is $event");
},
);
myBanner
// typically this happens well before the ad is shown
..load()
..show(
// Positions the banner ad 60 pixels from the bottom of the screen
anchorOffset: 60.0,
// Banner Position
anchorType: AnchorType.bottom,
);
Run Code Online (Sandbox Code Playgroud) 我只是在kotlin的初级水平.我没有任何办法在kotlin中为数组添加值.我想从用户获取值并将它们添加到数组中.
val arr = arrayOf<Int>()
Run Code Online (Sandbox Code Playgroud)
要么
var arr = intArrayOf()
Run Code Online (Sandbox Code Playgroud)
像在Java中一样
Scanner ob=new Scanner(System.in);
int arr[]=new int[5];
for(int i=0;i<arr.length;i++)
{
arr[i]=ob.nextInt();
}
Run Code Online (Sandbox Code Playgroud)
如何在kotlin中执行相同的操作?