2011-07-01 3 views
0

Je souhaite insérer une nouvelle ligne dans ma mise en page. comme dans la première ligne que j'ai 4 TextViews simples et sur la deuxième ligne je veux avoir des boutons .. Recherche jeter l'internet je suis arrivé à répondre comme ceci:LinearLayout Styling et fichier XML

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:gravity="center" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 


<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent">  

</LinearLayout> 
</LinearLayout> 

Mais quand je suis à la recherche à l'une im Desinger obtenir tous les wigets sur la même ligne Où est-ce que je me trompe?

Répondre

2

S'il vous plaît essayer ce ......

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:gravity="center" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"> 
<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent">  
    <TextView 
     android:text="Text" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"/> 
    <TextView 
     android:text="Text" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"/> 
    <TextView 
     android:text="Text" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"/> 
    <TextView 
     android:text="Text" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"/> 
</LinearLayout> 

    <LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent">  
    <Button 
     android:text="Text" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"/> 
</LinearLayout> 

+0

Nope. Encore le bouton est sur la même ligne avec le textView – Hakon89

+0

En fait je ne comprends pas pourquoi la réponse ne montre pas la disposition linéaire de racine. Utilisez une disposition linéaire d'orientation verticale et à l'intérieur de cette disposition linéaire ajoutez ce code –

+0

essayez là http://pastebin.ru/319682 Désolé la langue est rus, mais je ne connais pas les services comme ça en américain. là vous pouvez coller et éditer le texte que nous partageons – Hakon89

0

où sont vos 4 textures?

Mon conseil est de créer une nouvelle linearlayout avec l'orientation horizontale et à l'intérieur de ce mettre la 4 textview. Une autre solution consiste à créer un TableLayout et un TableRow.

J'espère que cela vous aidera.

+0

Pouvez-vous envoyer un fichier xml avec ça? Je ne suis pas sûr de tout ce que j'ai besoin de faire – Hakon89