0

ヘロ

私はこれを使います

<com.google.ads.AdView
        xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
        android:id="@+id/adView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="a1517edc9c6ed63" />

そしてJavaで

 AdView adView = (AdView)this.findViewById(R.id.adView);
            adView.loadAd(new AdRequest());

そして AndroidManifest で

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

そして私は外部JAR(GoogleAdMobAdsSdk-6.4.1)を持ってきました

しかし、彼は私と一緒に働きませんでした。

4

1 に答える 1

0

上のレイアウト xml ファイルにこの行を追加します。

xmlns:app="http://schemas.android.com/apk/lib/com.google.ads"

このように

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
    android:id="@+id/LinearLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
    <com.google.ads.AdView
        xmlns:googleads="http://schemas.android.com/apk/lib/com.google.ads"
        android:id="@+id/ad"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="0dp"
        app:adSize="BANNER"
        app:adUnitId="@string/admob_id" >
    </com.google.ads.AdView>
</LinearLayout>
 </LinearLayout>
于 2013-05-01T04:59:16.830 に答える