0

IMAGE Ci-joint le type de disposition que j'essaie d'avoir dans la disposition androïde. J'ai deux vues de texte placées l'une à côté de l'autre couvrant chacune la moitié de l'endroit horizontalement. Et puis j'ai d'autres vues de texte dans l'espace ci-dessous. J'allais utiliser la disposition relative, mais ensuite je ne pouvais pas les placer côte à côte et occuper la même quantité d'espace. Quelqu'un peut-il m'aider avec comment puis-je y parvenir?Utiliser des poids dans une disposition relative pour avoir des vues de texte côte à côte.

+1

puis utiliser LinearLayout avec weightsum = 2 et le poids = 1 pour les deux textview –

+0

agencement linéaire dans une disposition relative? – Kraken

+0

non seulement linearlayout. –

Répondre

2

essayer cette façon

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:gravity="center" 
     android:text="hello " /> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:gravity="center" 
     android:text="hello" /> 

</LinearLayout> 

<TextView 
    android:layout_marginTop="10dp" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center" 
    android:text="hello " /> 

<TextView 
    android:layout_marginTop="10dp" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center" 
    android:text="hello" /> 

</LinearLayout> 
+0

et comment puis-je ajouter les deux autres vues de texte qui sont placés verticalement ci-dessous. – Kraken

+0

vérifier mes mises à jour ans –

1

Essayez ci-dessous Logic.

LinearLayout 
    - Vertical Orientation 
    - LinearLayout 
     -HorizontalOrientation 
     -weightSum=2 
      -TextView1 with weight=1 
      -TextView2 with weight = 1 
    -TextView 3 
    -TextView 4