Fragment ne pas apparaître

Je vais avoir un problème où je peux créer un Fragment, de son point de vue semble être créé, mais il n'apparaît pas. Le fragment lui-même est créé et tout le code à l'intérieur fonctionne sans problème, mais il est juste invisible quelque part. Le bouton de retour interagit également avec elle juste fine ("ferme"), il n'a tout simplement pas physiquement afficher à l'écran (uniquement la page principale est affichée).

De mon FragmentActivity:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_view);

    //some logic here that sets a button listener that calls openAddNamePane() when pressed
}

public void openAddNamePane(){
    AddNamePane addNamePane = new AddNamePane();
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.replace(R.id.layout_root, addNamePane, "AddnamePane");
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.commit();
}

C'est la mise en page de la Vue qui est affiché en premier (activity_main_view.xml aka mon "racine mise en page'):

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"

    android:orientation="vertical"

    android:background="@color/white"
    android:id="@+id/layout_root">

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

        <Button android:id="@+id/addPlayerButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Add Player" />

        <Button android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/buttonLabel" />
    </LinearLayout>


    <ListView android:id="@+id/playerListView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:cacheColorHint="@color/white"
        android:entries="@array/testStringArray" >
    </ListView>

</LinearLayout>

C'est mon fragment de classe:

public class AddNamePane extends Fragment {
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
    }

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        System.out.println("AddNamePane.onCreateView()");

        View view = inflater.inflate(R.layout.add_player_pane_layout, container, false);

        return view;
    }

    //a few other methods here, onAttach(), onStop(), onPause(), etc
    //all are empty of logic with just a println to see if they are being called correctly (in which they are)
}

C'est la mise en page pour que "AddNamePane" fragment:

<?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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"

    android:orientation="vertical" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10" 
        android:text="test name here"
        android:hint="Name here" >
        <requestFocus />
    </EditText>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

</LinearLayout>

Je suis assez nouveau à l'aide de fragments, sais pas trop si ma question est dans le code ou si c'est quelque chose à voir avec les mises en page. Mon but est d'ajouter le "AddNamePane" à la racine de mise en page' remplacer la vue principale temporairement. Ce que j'ai fait cette tentative était de donner à ma racine mise en page d'un identifiant et d'utilisation que dans le FragmentTransaction. Si c'est important, le niveau de l'api que j'utilise est de 8 (Android 2.2) ainsi, en utilisant des choses à partir d'android.de soutien.v4.package de l'application.

source d'informationauteur mitim