Banner ads - adiant/android-sdk-example GitHub Wiki
Add an AdView element to your layout XML. Be sure to replace the ad unit ID with your ID, and choose the size of the ads you want. Add the adiant namespace as well.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:adiant="http://schemas.android.com/apk/res-auto"
<!-- ... -->
<com.adiant.android.ads.AdView
android:layout_width="match_parent"
android:layout_height="wrap_content"
adiant:adunitid="13325-2514722925"
adiant:adsize="AD_728_90"
adiant:smart="true" />
<!-- ... -->
Get a reference to the AdView element, set your ad unit ID and ad size (if you did not specify them in the XML), and load an ad:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// load banner ad
final AdView adView = (AdView) findViewById(R.id.adViewBannerAd);
adView.loadAd();
// rest of your code ...
}
Name | Width | Height |
---|---|---|
AD_300_250 | 300 px | 250 px |
AD_728_90 | 728 px | 90 px |
AD_320_50 | 320 px | 50 px |
AD_320_100 | 320 px | 100 px |
AD_468_60 | 468 px | 60 px |