2014-02-15 110 views
-1

您有任何想法如何在表面视图中包含Admob横幅?我尝试了很多小时,但没有奏效。Admob横幅在表面视图上

+0

您能否请添加您已经尝试过的代码? – donfuxx

+0

感谢您的回答! :)我没有代码了。对不起 – user2399229

+2

认为您应该尝试将您的SurfaceView包装到某个容器并添加标准的AdMob横幅 – alekz

回答

0

尝试这样的事情

Your_activity.xml

< ?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        xmlns:ads="http://schemas.android.com/apk/res-auto" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 

     <SurfaceView android:layout_width="match_parent" 
        android:layout_height="match_parent"/> 

     <com.google.android.gms.ads.AdView android:id="@+id/adView" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          ads:adUnitId="MY_AD_UNIT_ID" 
          android:layout_align_parrent_bottom="true" 
          ads:adSize="BANNER"/> 
    </RelativeLayout > 

或者创建代码AdMob的横幅。请参阅https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals的更多内容