2012-11-04 35 views
1

PICTURE:www.gunzhaxplz.com/xmlAndroid.png my problem http://gunzhaxplz.com/xmlAndroid.pngAndroid的XML tablerow的

前言:我想提出的是要求在tablerow的有6個圖像的應用程序。

問題:似乎這些圖像,我不能調整大小和右邊的最後一個圖像是在屏幕

這裏是XML:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/TableLayout1" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="horizontal" > 

<TableRow 
    android:id="@+id/tableRow1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" > 




    <ImageButton 
     android:id="@+id/imageButton1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:src="@drawable/golem_square" /> 





    <ImageButton 
     android:id="@+id/imageButton2" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:src="@drawable/lizard_square" /> 




    <ImageButton 
     android:id="@+id/imageButton3" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:src="@drawable/baron_square" /> 



    <ImageButton 
     android:id="@+id/imageButton4" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:src="@drawable/dragon_square" /> 

</TableRow> 

<TableRow 
    android:id="@+id/tableRow2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" > 

    <ImageButton 
     android:id="@+id/ImageButton03" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:src="@drawable/golem_square" /> 

    <ImageButton 
     android:id="@+id/ImageButton01" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:src="@drawable/lizard_square" /> 

    <ImageButton 
     android:id="@+id/ImageButton02" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:src="@drawable/baron_square" /> 

    <ImageButton 
     android:id="@+id/ImageButton04" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:src="@drawable/dragon_square" /> 
</TableRow> 

回答

1

嘗試設置每個ImageButton中的以下參數:

android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:adjustViewBounds="true" 
android:maxWidth="32dpi" 
android:maxHeight="32dpi" 
+0

現在他們太小謝謝我有一種方式來玩就是現在! :) –

+0

如果您想添加表格行的相對佈局,您可以使用佈局參數,如:android:layout_toRightOf =「@ id/button1」 –