2013-05-08 5 views
0

Je voudrais créer dans mon application des statistiques de a'la tiles metro. Malheureusement TextView n'a pas la même largeur, comme il a résolu?Egal TextView dans TableLayout

This is my layout

+0

Pour autant que je l'ai compris, le problème peut être dû au fait que vous avez mis android : layout_width = "match_parent", essayez de lui donner une valeur correspondant à vos besoins – Abx

+0

salut Artur, bienvenue à la communauté, pouvez-vous en décrire davantage sur votre problème? – stinepike

+0

Je ne pense pas que c'est une bonne idée d'imiter d'autres éléments de l'interface utilisateur comme indiqué dans les lignes directrices de conception Android ici: http://developer.android.com/design/patterns/pure-android.html – sandkasten

Répondre

0

Utilisez android:weightSum et android: layout_weight

<TableLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 

    <TableRow 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:weightSum="4" > 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginRight="1dp" 
      android:layout_weight="2" 
      android:background="#B0B0B0" /> 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginRight="1dp" 
      android:layout_weight="2" 
      android:background="#B0B0B0" /> 

    </TableRow> 

</TableLayout> 

Questions connexes