2012-02-29 57 views
0

我使用千禧年媒體和admob廣告。我在如何實現它們都有問題。 我希望廣告能夠顯示在應用程序的底部。如何實現2個不同的廣告出現在谷底

我以某事物一樣,對於相對佈局:

<RelativeLayout ... 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    > 
<com.millennialmedia.android.MMAdView 
     android:id="@+id/mmadview1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     ... 
     app:adType="MMBannerAdBottom" 
     app:height="60" 
     app:width="480" /> 

<com.google.ads.AdView android:id="@+id/adView1" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         ads:adSize="BANNER" 
         ... 
         ... 
          .. 
          android:layout_alignParentBottom="true"  /> 

    <TextView..../> 

    <Button.../> 

而且,我有一些個XML線性佈局:

<LinearLayout ... 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" 
> 
<com.millennialmedia.android.MMAdView 
    android:id="@+id/mmadview5" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    ... 
... 
    app:adType="MMBannerAdBottom" 
    app:height="60" 
    app:width="480" /> 

    <com.google.ads.AdView android:id="@+id/adView5" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        ads:adSize="BANNER" /> 

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" > 


    <TextView android:id="@+id/text1" 
     android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" /> 

<EditText 
    android:layout_width="180dip" 
    android:layout_height="wrap_content" 
android:id="@+id/num_cores" 
android:layout_below="@+id/text1" 
    /> 

    <Spinner 
    android:id="@+id/spinner" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_marginTop="20dip" /> 

    <TextView 
    android:id="@+id/core_search" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:linksClickable="true" 
    android:layout_toRightOf="@id/num_cores" 
    android:layout_marginLeft="45dip" 
    /> 

</RelativeLayout> 
    <TextView 
    android:id="@+id/text3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 

    <EditText 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
android:id="@+id/halftimecores" 

    /> 

    <TextView 
    android:id="@+id/text4" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 

    <EditText 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
android:id="@+id/timecores" 
    /> 

    <Button 
    android:id="@+id/core_calcs" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    /> 

    </LinearLayout> 

我只想廣告在bottom.How是秀我可以那樣做嗎? (現在,他們要麼出現在頂部或不出現)

回答

0

如果您使用的LinearLayout把它們按鈕後(@ + ID/core_calcs)如果你使用的RelativeLayout 採用Android:layout_below =「@ + ID/core_calcs「作爲第一次添加和android:layout_below =」@ + id/firstAdd_ID「作爲第二次添加

+0

:你好,它崩潰給予」異常導致:android.widget.button「。 – George 2012-02-29 17:35:22

+0

您是否在LinearLayout中的按鈕塊後放置了廣告? – 2012-03-01 07:07:55

+0

:是的,我把它們放在後面。 – George 2012-03-01 09:33:13