我的 admob 广告和我的下一张图片之间有一个差距。为什么?间隙与广告的高度大致相同。这是我的 XML:
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:gravity="center_horizontal"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="@+id/companylogo"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.2"
android:background="@drawable/hotluxa"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/kisstabutton"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:src="@drawable/clear" />
</LinearLayout>
<LinearLayout
android:id="@+id/vehicletype"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.5"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/corvetteconvertible"
android:src="@drawable/clear" />
</LinearLayout>
<LinearLayout
android:id="@+id/soundoptions"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.12"
android:orientation="horizontal">
<ImageButton
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:id="@+id/imageButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/greenbubble"
android:src="@drawable/clear" />
</LinearLayout>
<ImageButton
android:id="@+id/imageButton6"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.12"
android:background="@drawable/fullversion"
android:src="@drawable/clear" />
</LinearLayout>
对于我的 java 文件(提取): super.onCreate(savedInstanceState); setContentView(R.layout.mainxml); Log.e("main", "mainxml 加载正常");
// Create the adView
adView = new AdView(this, AdSize.BANNER, "a1509a21e11b5e1");
// Lookup your LinearLayout assuming it's been given
// the attribute android:id="@+id/mainLayout"
LinearLayout layout = (LinearLayout) findViewById(R.id.linearad);
Log.e("main", "1");
// Add the adView to it
layout.addView(adView);
Log.e("main", "2");
// Create an ad request. Check logcat output for the hashed device ID to
// get test ads on a physical device.
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
Log.e("main", "3");
// Initiate a generic request to load it with an ad - should be when finished: adView.loadAd(new AdRequest());
adView.loadAd(adRequest);