Admob不会产生视觉效果

时间:2013-09-29 19:31:01

标签: android xml admob android-tablelayout

我的脸书横幅没有出现在我的屏幕上。它编译并运行良好。我试图将它插入几个地方。我正在使用它作为应用程序的页脚。我留下了第二个评论,以便你可以看到我试图把它放在哪里。

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
             >
<ScrollView 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:foregroundGravity="right"
    android:background = "@drawable/background"
     >


<TableLayout
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
 >    

    <TableRow>        
    <Button 
      android:id="@+id/btn1"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="hot enough"
      android:textColor="#ff0000"
    />    
       <Button 
      android:id="@+id/btn2"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="learned"
      android:textColor="#ff0000"
    />    
       <Button 
      android:id="@+id/btn3"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="hilbilly"
      android:textColor="#ff0000"
    />    
       <Button 
      android:id="@+id/btn4"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="rot"
      android:textColor="#ff0000"
    />    
    </TableRow>
    <TableRow>   
       <Button 
      android:id="@+id/btn73"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
       android:background="#00000000"      
       android:text="nicetry"
      android:textColor="#ff0000"
    />    
       <Button 
      android:id="@+id/btn74"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="look bad"
      android:textColor="#ff0000"
    />
     <Button 
      android:id="@+id/btn75"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="revenge"
      android:textColor="#ff0000"

    />                 
    <Button 
      android:id="@+id/btn76"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="group"
      android:textColor="#ff0000"
    /> 
    </TableRow>
    <TableRow>   
       <Button 
      android:id="@+id/btn77"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="takedown"
      android:textColor="#ff0000"
    />    
        <Button 
      android:id="@+id/btn78"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
       android:background="#00000000"      
       android:text="knock"
      android:textColor="#ff0000"
    />    
       <Button 
      android:id="@+id/btn79"
      android:layout_width="wrap_content" 
      android:layout_height="103dp"  
      android:layout_weight="1"
      android:background="#00000000"
      android:text="casket"
      android:textColor="#ff0000"
    />       
    </TableRow>
<!--    <TableRow>
  <com.google.ads.AdView 
     android:id="@+id/adView"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     ads:adUnitId="pub-4235852256372242"
     ads:adSize="BANNER"
     ads:testDevices="TEST_EMULATOR, 512CF178FE3E3613A01DC3FBA545BD86"
     ads:loadAdOnCreate="true"
     />        
    </TableRow> 
    -->
</TableLayout>      

</ScrollView>
          <com.google.ads.AdView 
     android:id="@+id/adView"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     ads:adUnitId="pub-4235852256372242"
     ads:adSize="BANNER"
     ads:testDevices="TEST_EMULATOR, 512CF17****************"
     ads:loadAdOnCreate="true"
     /> 
</LinearLayout>

enter image description here

10-01 23:19:53.294: D/ActivityThread(12826): setTargetHeapUtilization:0.25
10-01 23:19:53.294: D/ActivityThread(12826): setTargetHeapIdealFree:8388608
10-01 23:19:53.294: D/ActivityThread(12826): setTargetHeapConcurrentStart:2097152
10-01 23:19:53.474: D/dalvikvm(12826): GC_FOR_ALLOC freed 57K, 30% free 14739K/20995K,     paused 25ms, total 26ms
10-01 23:19:53.544: D/dalvikvm(12826): GC_CONCURRENT freed <1K, 21% free 24914K/31175K, paused 20ms+6ms, total 44ms
10-01 23:19:53.964: I/webclipboard(12826): clipservice:  android.sec.clipboard.ClipboardExManager@435a37d0
10-01 23:19:54.004: I/webclipboard(12826): clipservice: android.sec.clipboard.ClipboardExManager@435a37d0
10-01 23:19:54.195: I/webclipboard(12826): clipservice: android.sec.clipboard.ClipboardExManager@435a37d0
10-01 23:19:54.205: V/webkit(12826): BrowserFrame constructor: this=Handler   (android.webkit.BrowserFrame) {4359e848}
10-01 23:19:54.325: V/webkit(12826): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {436661b8}
10-01 23:19:54.325: V/webkit(12826): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {4366da58}
10-01 23:19:54.465: I/Adreno200-EGLSUB(12826): <ConfigWindowMatch:2087>: Format RGBA_8888.
10-01 23:19:54.525: E/(12826): <s3dReadConfigFile:75>: Can't open file for reading
10-01 23:19:54.525: E/(12826): <s3dReadConfigFile:75>: Can't open file for reading
10-01 23:19:54.725: I/Ads(12826): adRequestUrlHtml: <html><head><script   src="http://media.admob.com/sdk-core-v40.js"></script> <script>AFMA_getSdkConstants();AFMA_buildAdURL({"preqs":0,"session_id":"2377731330464712201 ","seq_num":"1","slotname":"pub- 4235852256372242","u_w":360,"msid":"com.mrj05hua.hanselgretelwhfree","adtest":"on","js":"af ma-sdk-a- v6.4.1","bas_off":0,"net":"wi","app_name":"1.android.com.mrj05hua.hanselgretelwhfree","hl": "en","gnt":13,"carrier":"311480","u_audio":3,"kw":[],"u_sd":2,"ms":"xxPCYSmHc43AN0YQtB8lGKj2Nu9vDYWw8gtoq7Hi8wmKf5LNzvuTUqGgNUoYXdWcrBgSfDwLuSWaxYKq3qmQra0A5dPF1rppxBS9U0n05OLIqyXKefZQ-ihaTYaGjnUalp6LbNQUQpeHG6H6w_LhCpzxs_th1Om5ot-JZEA-gN25L-iXBS7DEU4_W-s4eMW3SzqYcvY3FsMLQJtA805-ixUsWHeaesRbxyStEOPWOYi0sujnAJ3zb6LnfwQHC-ZQsx56r4yj-o8bTFg275wd260E6P8aBZ70GskV0IDEijwQWiS9WpK7nx-3l38Ift5ANXbvxPvEZSHNxizH8xAacg","mv":"80230011.com.android.vending","isu":"512CF178FE3E3613A01DC3FBA545BD86","format":"320x50_mb","oar":0,"ad_pos":{"height":0,"visible":0,"y":0,"x":0,"width":0},"u_h":640,"pt":2,"bas_on":0,"ptime":0});</script></head><body></body></html>
10-01 23:19:55.666: D/WebCore(12826): uiOverrideUrlLoading: shouldOverrideUrlLoading() returnstrue
10-01 23:19:55.706: I/GATE(12826): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
10-01 23:19:55.776: W/Ads(12826): Invalid unknown request error: Cannot determine  request type. Is your ad unit id correct?
10-01 23:19:55.776: D/WebCore(12826): uiOverrideUrlLoading: shouldOverrideUrlLoading() returnstrue
10-01 23:19:55.776: I/Ads(12826): onFailedToReceiveAd(Invalid Ad request.)

2 个答案:

答案 0 :(得分:2)

您的adUnitId不正确。它应该像“ca-app-pub-XXXXXXXXXXXX / YYYYYYYYYY”,而不是“pub-4235852256372242”

答案 1 :(得分:0)

您可以参考

Admob ad not showing up in emulator or phone

如果您是使用admob的新用户,则可能需要几天时间才能加载实际广告。