我的admob广告后为什么会有差距?

时间:2012-11-14 04:47:51

标签: android admob

我的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);

1 个答案:

答案 0 :(得分:0)

清理旧案。我相信50dp的高度确实解决了。