Merhaba Arkadaşlar ,
Banner reklamı ekranın üst tarafında ve alt tarafında göstermek için XML dosyamızı nasıl hazırlayacağımızı paylaşacağım.
Ekran üstünde paylaşmak için:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Burda ben webview kullanmıstım ama siz istediğiniz gibi farklı layoutlar yada componentlar kullanabilirsiniz
-->
<WebView
android:id="@+id/webView1"
android:layout_below="@+id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</WebView>
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
ads:adSize="SMART_BANNER"
android:layout_alignParentTop="true"
ads:adUnitId="ca-app-pub-6311389967106147/559582xxxx"
/>
</RelativeLayout>
Ekran Altında paylaşmak için:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Burda Burda ben webview kullanmıstım ama siz istediğiniz gibi farklı layoutlar yada componentlar kullanabilirsiniz -->
<WebView
android:id="@+id/webView1"
android:layout_above="@+id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</WebView>
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
ads:adSize="SMART_BANNER"
android:layout_alignParentBottom="true"
ads:adUnitId="ca-app-pub-6311389967106147/559582xxxx"
/>
</RelativeLayout>
Tüm Android Ders, Proje ve Kaynak Kodlar için tıklayınız.
Admob banner reklam ekleme dersimiz için tıklayınız.
Admob geçir reklam ekleme dersimiz için tıklayınız.
1
