Jak dodać banner ale nie w xml bo chciałbym ustawić wysokość % względem ekranu. I chciałbym dodać to w gridView. Robię tak
rowView = inflater.inflate(R.layout.ads_grid_home, null);
MobileAds.initialize(rowView.getContext(), "ca-app-pub-3940256099942544/6300978111");
AdView adView = new AdView(rowView.getContext());
adView.setAdSize(new AdSize(200, 250);
adView.setAdUnitId("ca-app-pub-3940256099942544/6300978111");
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
Ale nie działa. ads_grid_home jest pustym xml z
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
Jak to dodać aby działało?