コード例 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_banner_programmatic);

            adStatusTextView = FindViewById <TextView>(Resource.Id.status_label);

            adView = new AppLovinAdView(AppLovinAdSize.Banner, "YOUR_ZONE_ID", this);

            adView.Id = ViewCompat.GenerateViewId();

            var loadButton = FindViewById <Button>(Resource.Id.load_button);

            loadButton.Click += LoadButton_Click;

            adView.SetAdLoadListener(this);
            adView.SetAdDisplayListener(this);
            adView.SetAdClickListener(this);
            adView.SetAdViewEventListener(this);

            // Add programmatically created banner into our container
            var bannerProgrammaticContentLayout = FindViewById <ConstraintLayout>(Resource.Id.banner_programmatic_layout);

            bannerProgrammaticContentLayout.AddView(adView, new ConstraintLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, AppLovinSdkUtils.DpToPx(this, 50)));

            var constraintSet = new ConstraintSet();

            constraintSet.Clone(bannerProgrammaticContentLayout);
            constraintSet.Connect(adView.Id, ConstraintSet.Bottom, Resource.Id.banner_programmatic_layout, ConstraintSet.Bottom, 0);
            constraintSet.ApplyTo(bannerProgrammaticContentLayout);

            // Load an ad!
            adView.LoadNextAd();
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_leader_layout_editor);

            adStatusTextView = FindViewById <TextView>(Resource.Id.status_label);

            adView = FindViewById <AppLovinAdView>(Resource.Id.ad_view);
            var loadButton = FindViewById <Button>(Resource.Id.load_button);

            loadButton.Click += LoadButton_Click;

            adView.SetAdLoadListener(this);
            adView.SetAdDisplayListener(this);
            adView.SetAdClickListener(this);
            adView.SetAdViewEventListener(this);

            // Load an ad!
            adView.LoadNextAd();
        }
コード例 #3
0
 private void LoadButton_Click(object sender, EventArgs e)
 {
     Log("Loading ad...");
     adView.LoadNextAd();
 }