J'ai fait une note lorsque j'ai créé BottomNavigationView une fois et que j'ai créé Tabhost et son fragment. 
J'ai principalement fait référence à la référence en bas, mais je la corrige parce que des erreurs se sont produites.
Tout d'abord, il s'agit de l'un de chaque fragment divisé par BottomNavigationView. 
Fragment parent.java
le fragment parent de classe publique étend le fragment{
    public static Record newInstance() {
        return new Record();
    }
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.record, container, false);
        //Obtenez Fragment Manager
        FragmentManager mFragmentManager = getChildFragmentManager();
        //Obtenez FragmentTabHost à partir de xml, l'identifiant est Android.R.id.Notez que c'est tabhost
        FragmentTabHost tabHost = (FragmentTabHost)v.findViewById(android.R.id.tabhost);
        Log.d("tabHost", String.valueOf(tabHost));
        //Configurez en passant le Context, le FragmentManager et l'ID de la vue qui correspond au fragment.
        tabHost.setup(getActivity().getApplicationContext(), mFragmentManager, R.id.content);
        //Passez n'importe quel id à l'argument de type String
        //Cette fois, nous préparerons deux TabSpecs pour basculer entre les deux fragments à partir du FragmentTabHost.
        TabHost.TabSpec mTabSpec1 = tabHost.newTabSpec("tab1");
        TabHost.TabSpec mTabSpec2 = tabHost.newTabSpec("tab2");
        //Passez les caractères à afficher sur l'onglet
        mTabSpec1.setIndicator("This is tab1");
        mTabSpec2.setIndicator("This is tab2");
        Bundle args = new Bundle();
        args.putString("string", "message");
        //Passer un argument pour associer une classe à chaque TabSpec
        //En ayant un Bundle comme troisième argument, vous pouvez passer une valeur à Fragment. Passer null si pas nécessaire
        tabHost.addTab(mTabSpec1,Fragment enfant 1.class, args);
        tabHost.addTab(mTabSpec2,Fragment enfant 2.class, null);
        return v;
    }
}
Fragment enfant 1.java
le fragment 1 de l'enfant de la classe publique étend le fragment{
fragment enfant statique 1 newInstance() {retourne le nouveau fragment enfant 1();}
    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        //Si vous passez un Bundle pendant addTab, obtenez la valeur du Bundle
        //Ne passe pas(Passer nul)Dans ce cas, il n'est pas nécessaire de le mettre en œuvre. Sinon getString("string")Parfois, une erreur se produit
        Bundle args = getArguments();
        String str = args.getString("string");
    }
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
        return inflater.inflate(R.layout.Disposition du fragment enfant 1, null);
    }
}
Fragment enfant 2.java
le fragment enfant de la classe publique 2 étend le fragment{
fragment enfant statique 2 newInstance() {retourne le nouveau fragment enfant 2();}
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
        return inflater.inflate(R.layout.Disposition du fragment enfant 2, null);
    }
}
Disposition du fragment parent.xml
<?xml version="1.0" encoding="utf-8"?>
<!--L'identifiant de FragmentTabHost doit être@android:id/make it tabhost-->
<android.support.v4.app.FragmentTabHost
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <!--Comme FragmentTabHost, id est spécifié. id doit être@android:id/aux onglets-->
        <TabWidget
            android:id="@android:id/tabs"
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"/>
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="0"/>
        <!--Un fragment est ajouté au contenu-->
        <FrameLayout
            android:id="@+id/content"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"/>
    </LinearLayout>
</android.support.v4.app.FragmentTabHost>
Disposition du fragment enfant.xml(Disposition du fragment enfant1,Disposition du fragment enfant2)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:id="@+id/textView3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Fragment enfant" />
</LinearLayout>
Remarques: 
Il y a «android.app.Fragment ~» et «android.support.v4.app.Fragment ~» dans le système Fragment, mais il semble préférable de les unifier (naturellement.) 
 [Norme Android J'utilise la v4 en me référant à l'article "Support.v4.app.Fragment devrait être utilisé plutôt que Fragment" (http://qiita.com/LyricalMaestro0/items/a8bafa653fad23dead8e).
Référence: 
Mémorandum FragmentTabHost
Recommended Posts