0

레이아웃에 admob을 올바로 배치하는 데 문제가 있습니다. 아무리 내가 그것을 넣어도 나는 광고를 전혀 보지 않는 것처럼 보인다. 여기에 2 개 레이아웃 ...admob android help

main.xml에이

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/linearLayout" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#0000"> 
<ListView 
android:id="@+id/android:list" 
android:background="#0000" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:dividerHeight="1dip"/> 
</LinearLayout> 

layout2.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="?android:attr/listPreferredItemHeight" 
android:padding="10dip" 
android:background="#0000"> 
<TableLayout 
android:layout_width="fill_parent" 
android:layout_weight="1" 
android:layout_height="fill_parent" 
android:stretchColumns="*" 
android:background="#0000"> 
<TableRow> 
<TextView 
android:id="@+id/description" 
android:padding="2dip" 
android:textColor="#ffff" 
android:background="#0000"/> 
</TableRow> 
</TableLayout> 
</LinearLayout> 

와 몹의 자바 코드가 안드로이드입니다 : ID = "@ + ID/linearLayout " 이 이미 메인 레이아웃에 있습니다. 문제는 그것이 표시되지 않는다는 것입니다. 그러나 레이아웃 프로젝트 온라인으로 admob java 부분 만 있으면 새 프로젝트를 만들면 광고를 볼 수 있습니다.

은 그래 나 또한 내가 내가 잘못을하고있는 중이 않는 상대 레이아웃하지만 또한 나던 작업을 사용 들었다 주요

<activity android:name="com.google.ads.AdActivity" 
android:configChanges="keyboard|keyboardHidden|orientation"/> 
</application> 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

에 적절한 코드를 추가했습니다. 누군가가 도울 수 있기를 바랍니다!

갱신 1 : 여기 아래의 예에 따라 전자로 AdView를 추가하려면 main.xml에에서

// Lookup R.layout.main 
    LinearLayout layout = 
    (LinearLayout)findViewById(R.id.linearLayout); 
    // Create the adView 
    // Please replace MY_BANNER_UNIT_ID with your AdMob Publisher ID 
    AdView adView = new AdView(this, AdSize.BANNER, "a14e458091154df"); 
    // Add the adView to it 
    layout.addView(adView); 
    // Initiate a generic request to load it with an ad 
    AdRequest request = new AdRequest(); 
    request.setTesting(true); 
    adView.loadAd(request); 
+0

adView를 추가 할 수있는 Java 코드가 있습니까? 그것이 그대로라면 나는 admob에 관련된 것을 볼 수 없다. – Smugrik

+0

yes linearLayout은 자바 코드에서 admob을 가리킨다. 이것은 내가 admob 웹 사이트에서 발견 한 유일한 실례이다. 그래서 나는 그것에 매달렸다. 모든 것이 그 자체로 작동하는 것처럼 보입니다. 여기에 자바의 코드가 있습니다 .... – woozie

+0

javacode는 첫 번째 게시물에서 update1에 있습니다. – woozie

답변

0

을 AdMob으로 ID/LinearLayout에 + @가 사용하는 자바 코드도 추가하는 것을 잊지 마세요 XMLNS : 광고 = "http://schemas.android.com/apk/lib/com.google.ads"주요있는 LinearLayout 정의에 및

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
android:id="@+id/linearLayout" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#0000"> 
    <com.google.ads.AdView android:id="@+id/adView" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         ads:adUnitId="MY_AD_UNIT_ID" 
         ads:adSize="BANNER" 
         ads:loadAdOnCreate="true"/> 
<ListView 
android:id="@+id/android:list" 
android:background="#0000" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:dividerHeight="1dip"/> 
</LinearLayout> 

또한 AdMob 게시자 ID로 MY_AD_UNIT_ID 교체 더보기 this page의 예

+0

강제로 닫습니다. javacode는 첫 번째 게시물에서 update1에 있습니다. – woozie

+0

LogCat 스택 추적을 게시하십시오. 충돌의 원인에 대한 정보가 있어야합니다. – Smugrik