皆さん、これまでのところ、Admob を通常の線形レイアウトに実装することができました。今、私は追加を追加scrollviewし、adbanner消えました。それに対して何ができるかわかりません。
を追加した .xml のコードに従いますscrollview。
<?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="match_parent">
<ScrollView android:id="@+id/scrollView1" android:layout_height="wrap_content" android:layout_width="match_parent">
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
[whole bunch of layout elements whoch shouldn´t affect the adbanner]
</LinearLayout>
</ScrollView>
私の線形レイアウトでは、adbanner が引き続き機能し、adbanner の位置全体がメインの activitiy.java ファイルで行われました (taiic.com のチュートリアルの助けを借りてこれを行いました)。
// 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
String pubID = "xxxxxxxxxxxxxxxxxx";
AdView adView = new AdView(this, AdSize.BANNER, pubID);
// 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);
admobバナーをに実装するときに、何を変更するか、またはどのコードを追加するかを誰か教えてもらえますscrollviewか?
編集:
私は追加しようとしました
<com.admob.android.ads.AdView
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
myapp:backgroundColor="#000000"
myapprimaryTextColor="#FFFFFF"
myapp:secondaryTextColor="#CCCCCC"
android:alignParentBottom="true"/>
.xml の最後の 2 行の間
</LinearLayout>
[here]
</ScrollView>
しかし、その後、「エラー:XMLの解析中にエラーが発生しました:バインドされていないプレフィックス」というエラーが表示されます
乾杯