J'ai un problème weired avec la mise en page de mon application. J'ai un listview, dans lequel j'ai inséré une propre mise en page pour chaque article. Cela fonctionne bien.problème linearlayout
Voici une partie de la mise en page XML inséré:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:id="@+id/label"
android:paddingTop="2px"
android:paddingLeft="15px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp" />
<TextView
android:id="@+id/price"
android:paddingTop="2px"
android:paddingLeft="15px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp" />
<TextView
android:id="@+id/days"
android:paddingTop="2px"
android:paddingLeft="15px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp" />
<TextView
android:id="@+id/test"
android:paddingTop="2px"
android:paddingLeft="15px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp" />
<TextView
android:id="@+id/status"
android:paddingTop="2px"
android:paddingLeft="15px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp" />
</LinearLayout>
Dans mon activité, je fais ce qui suit:
tv = (TextView) row.findViewById(R.id.price);
tv.setText(getString(R.string.wishlist_price) + ": " + "293.99€");
getString (R.string.wishlist_price) est défini dans string.xml comme "Prix"
Maintenant la chose étrange: Pour la "293.99 €" ci-dessus "la sortie sur le téléphone ressemble à ceci:
Price: 293.99€
Mais si je change l'argent, par exemple à 22,95 €, la sortie ressemble à ceci:
Price:
22.95€
Alors il fait un saut de ligne après « Prix: » Je ne peux pas trouvé ce qui est à l'origine ce.
Je l'ai essayé avec « 2,99 € », il donne la sortie prévue:
Price: 2.99€
Est-ce que quelqu'un a une idée de ce qui est à l'origine du saut de ligne dans l'exemple « 22,95 € »?
EDIT: Il existe deux configurations linéaires autour de celle ci-dessus. Peut-être qu'ils provoquent ce comportement étrange:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:id="@+id/product_item"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
Votre texte de la question présente quelques problèmes de formatage. Essayez de placer votre sortie dans un bloc de code afin que nous puissions voir ce que vous voulez dire. –
Désolé. Maintenant, je l'ai édité – tobias
Un autre commentaire avant de répondre. N'utilisez pas d'unités de pixels, utilisez toujours des pixels indépendants de la densité ('dp' ou' dip'). Votre interface évoluera beaucoup mieux avec les différentes résolutions sur les appareils Android. –