2010-11-03 5 views
0

cela est essentiellement ce que je veux atteindre: http://i52.tinypic.com/15qelwy.jpgcomment créer TableLayout compliqué sur android

jusqu'à présent ce fichier est mon main.xml

<TableLayout 
    android:paddingTop="80sp" 
    android:paddingLeft="40sp" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <TableRow> 
    <TextView 
    android:text="@string/questions" 
    android:textColor="#000" 
    android:textStyle="bold" 
    android:textSize="18dip" 
    android:layout_height="100px" 
    android:layout_width="100px"/> 
    <ImageButton 
    android:id="@+id/button_one" 
    android:src="@drawable/button_flat" 
    android:layout_width="227px" 
    android:background="@null" 
    /> 
    <ImageButton 
    android:id="@+id/button_one" 
    android:src="@drawable/button_flat" 
    android:layout_width="227px" 
    android:background="@null" 
    /> 
    </TableRow> 
</TableLayout> 

Le résultat est pas joli car il affiche la 2ème bouton dans une autre colonne. Comment puis-je créer seulement deux colonnes; le premier est extensible et la colonne suivante contient plusieurs boutons d'image?

merci.

Répondre

0

Peut-être que quelque chose comme ça?

<?xml version="1.0" encoding="utf-8"?> 

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:paddingTop="80sp" 
android:paddingLeft="40sp" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 

<TableRow> 
    <TextView 
    android:text="@string/questions" 
    android:textColor="#000" 
    android:textStyle="bold" 
    android:textSize="18dip" 
    android:layout_height="100px" 
    android:layout_width="fill_parent"/> 

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" > 
     <ImageButton 
     android:id="@+id/button_one" 
     android:src="@drawable/button_flat" 
     android:layout_width="227px" 
     android:background="@null" 
     /> 
     <ImageButton 
     android:id="@+id/button_one" 
     android:src="@drawable/button_flat" 
     android:layout_width="227px" 
     android:background="@null" 
     /> 
</LinearLayout> 
</TableRow> 
</TableLayout> 
Questions connexes