J'essaye de construire une disposition de terrain de badminton pour une application du mien. Après quelques expériences, j'ai eu une belle apparence, comme ça (field.xml voir ci-dessous).Comment construire une disposition de terrain de badminton?
Je sais que ce n'est probablement pas la meilleure façon de créer une disposition de terrain de badminton, mais je n'ai pas trouvé de meilleure solution depuis maintenant. Si quelqu'un a une meilleure idée de la façon de construire le champ, j'apprécierais tous les commentaires.
Le problème principal est le fait que je veux ajouter du texte à certains champs de texte. Dès que j'ajoute du texte dans les champs, ma mise en page est rompue:
Lorsque je supprime l'attribut layout_width: wrap_content de ces éléments de texte, l'éditeur de l'interface utilisateur l'affiche correctement: wanted layout.png.
Mais comme les attributs layout_width manquent, l'application ne chargera pas cette disposition sur mon appareil.
Des idées pour ajouter du texte aux champs sans endommager la mise en page?
field.xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/row1"
style="@style/topborder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:orientation="horizontal" >
<TextView
android:id="@+id/field11"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal" />
<TextView
android:id="@+id/field12"
style="@style/rightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#000000"
android:gravity="center"
android:text="Team 1" />
<TextView
android:id="@+id/field13"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
<TextView
android:id="@+id/field14"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/row2"
style="@style/bottomborder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:orientation="horizontal" >
<TextView
android:id="@+id/field21"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
<TextView
android:id="@+id/field22"
style="@style/rightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#000000"
android:gravity="center"
android:text="21"
android:textSize="50dp" />
<TextView
android:id="@+id/field23"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
<TextView
android:id="@+id/field24"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/row3"
style="@style/bottomborder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:orientation="horizontal" >
<TextView
android:id="@+id/field31"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
<TextView
android:id="@+id/field32"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="2"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
<TextView
android:id="@+id/field33"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/row4"
style="@style/bottomborder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:orientation="horizontal" >
<TextView
android:id="@+id/field41"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
<TextView
android:id="@+id/field42"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="2"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
<TextView
android:id="@+id/field43"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="@+id/row5"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:orientation="horizontal" >
<TextView
android:id="@+id/field51"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
<TextView
android:id="@+id/field52"
style="@style/rightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
<TextView
android:id="@+id/field53"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#000000"
android:gravity="center"
android:text="10"
android:textSize="50dp" />
<TextView
android:id="@+id/field54"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/bottomborder"
android:id="@+id/row6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:orientation="horizontal" >
<TextView
android:id="@+id/field61"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
<TextView
android:id="@+id/field62"
style="@style/rightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
<TextView
android:id="@+id/field63"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#000000"
android:gravity="center"
android:text="Team 2" />
<TextView
android:id="@+id/field64"
style="@style/leftrightborder"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#000000"
android:gravity="center_horizontal"
android:text="" />
</LinearLayout>
Avez-vous essayé de placer toutes les largeurs android: layout_width = « match_parent »? À la fois sur les mises en page et sur les vues de texte – DecodeGnome
La mise en page est-elle corrigée dans l'orientation portrait? – Luksprog
@DecodeGnome Pour autant que je sache, match_parent est juste une variante renommée de fill_parent. –