2011-01-25 78 views
0

如何讓我的廣告顯示在屏幕底部?Android AdMob - 對齊/位置廣告

我已經嘗試將重力設置爲底部,但它仍然不會改變。

當前頁面代碼:

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@color/Background_Color"> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    xmlns:myapp="http://schemas.android.com/apk/res/com.x.x" > 
    <TextView android:id="@+id/out_text" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent" 
    android:textSize="30dip" 
    android:textColor="@color/Text_Color" /> 

    <com.admob.android.ads.AdView 
    android:id="@+id/ad" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    myapp:backgroundColor="#000000" 
    myapp:primaryTextColor="#FFFFFF" 
    myapp:secondaryTextColor="#CCCCCC" 
    myapp:refreshInterval="10" 
    android:visibility="visible" /> 
</LinearLayout> 
</ScrollView> 

任何幫助將不勝感激!

回答

2

嘗試向您的TextView添加一個權重。

android:layout_weight="1" 

這意味着,它將佔用父母的任何空餘空間。

這增加了滾動型:

android:fillViewport="true" 
+0

這沒有奏效。 – user576820 2011-01-26 01:38:01

+0

還要將以下行添加到scrollView:android:fillViewport =「true」。這應該使一切按預期工作:) – tribe84 2011-01-26 02:32:59

2

嘗試使用RelativeLayout的替代,並給予AdView中的android:layout_alignParentBottom="true"的屬性。

此外,引力隻影響內容,layout_gravity影響視圖本身。 (你可能知道,只是指出來)