2012-11-04 2 views
1

영상 : www.gunzhaxplz.com/xmlAndroid.png my problem http://gunzhaxplz.com/xmlAndroid.png안드로이드 XML의 tablerow

서문 : 나는 tablerow에 6 개 이미지를 가질 필요로하는 응용 프로그램을 만드는 중이라서.

에 문제 :

<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

이 설정을보십시오 : 이미지는 내가 크기를 조정할 수없는 것, 오른쪽의 마지막 이미지가 화면 여기

의 부족은 XML이다 각 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" –