Ensemble de fragments de positions de android activités

J'ai un fragment qui devrait être montré dans une activité sous un autre fragment

Dans le xml du fragment, j'ai essayé d'utiliser:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/second_fragment"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="10sp"
    android:layout_below="@id/first_fragment">  
    <TextView 
        android:id="@+id/mytext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=" "
        android:focusable="false"
        android:clickable="false"
        android:textSize="20sp"
        android:padding="5sp"
        android:layout_centerHorizontal="true"/>    
</RelativeLayout>

(veuillez noter android:layout_below="@id/first_fragment" dans la balise de disposition)

J'ai aussi essayé ceci:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/first_fragment"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="10sp">     
    <TextView 
        android:id="@+id/mytext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=" "
        android:focusable="false"
        android:clickable="false"
        android:textSize="20sp"
        android:padding="5sp"
        android:layout_centerHorizontal="true"
        android:layout_below="@id/first_fragment"/>     
</RelativeLayout>

(veuillez noter android:layout_below="@id/first_fragment" dans le TextView tag)

dans les deux cas, l'application compiler et exécuter, mais le deuxième fragment est indiqué sur le haut de l'écran, plutôt que d'après la première.

Veuillez considérer que je suis en ajoutant les fragments par programmation à l'aide FragmentTransaction et j'ajoute le deuxième fragment après avoir ajouté le premier, mais dans la même transaction

Pouvez-vous me dire quel est le problème?

Merci

InformationsquelleAutor kingston | 2011-10-10