2013-08-27 103 views
0

我在屏幕底部設置TableRow時遇到問題。如果按鈕與Google廣告之間的TableRows爲空,則GoogleAds不在屏幕底部。我嘗試幾乎所有東西。在這張照片的左側(http://qkoment.php5.sk/image/image_screen.PNG)是我所擁有的,右側是我想要的。如何在android中使用xml在屏幕底部設置TableRow

這裏是我的代碼:

<?xml version="1.0" encoding="utf-8"?> 
    <TableLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/TableLayout03" 
     xmlns:app="http://schemas.android.com/apk/lib/com.google.ads"> 
     <TableRow 
     android:id="@+id/TableRow04" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:gravity="center"> 
     <Spinner 
      android:id="@+id/Spinner01" 
      android:layout_width="wrap_content" 
      android:layout_height="40dip" 
      android:layout_weight=".3" 
      android:background="@drawable/button" > 
     </Spinner> 
    </TableRow> 
    <TableRow 
     android:id="@+id/TableRow05" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"> 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/tv1" 
      android:paddingLeft="10sp" 
      android:textColor="@color/blacky" 
      android:layout_weight="1"> 
     </TextView> 
    </TableRow> 
    <TableRow 
     android:id="@+id/TableRow01" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:gravity="center"> 
    </TableRow> 
    <TableRow 
     android:id="@+id/TableRow02" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:gravity="center"> 
    </TableRow> 
    <TableRow 
     android:id="@+id/TableRow03" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:gravity="center"> 
    </TableRow> 
    <TableRow> 
    <com.google.ads.AdView 
     xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
     android:id="@+id/adView" 
     android:padding="0dp" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     ads:loadAdOnCreate="true" 
     app:adSize="BANNER" 
     android:layout_gravity="bottom" 
     app:adUnitId="myID" > 
    </com.google.ads.AdView> 
    </TableRow> 
</TableLayout> 

感謝每一個答案/建議。

回答

1

它不這樣工作。爲什麼要將廣告放在TableRow中? 隨着RelativeLayout的,你可以放置一個視圖屏幕與底:

android:layout_alignParentBottom="true" 
+0

謝謝你,我嘗試這種解決方案,它的工作原理。 –

相關問題