2016-12-21 8 views
0

CoordinatorLayoutにフラグメントを追加できないようです。挿入しようとすると、何もクラッシュすることはありませんが、断片は表示されませんが、次元を評価するとゼロ以外の値になります。 CoordinatorLayoutRelativeLayoutに変更すると、フラグメントが表示されます。 CoordinatorLayoutEditTextを追加すると、EditTextが表示されます。 CoordinatorLayoutにフラグメントが表示されないのはなぜですか?CoordinatorLayoutにフラグメントを追加します

次のように私のXMLは次のとおりです。

<android.support.design.widget.CoordinatorLayout  
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/coordinator" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.v7.widget.RecyclerView  
     android:id="@+id/recycler" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <FrameLayout 
     android:id="@+id/fragment_container" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:layout_behavior="com.mypackage.Behavior"> 

    </FrameLayout> 
</android.support.design.widget.CoordinatorLayout> 

次のように私は私の断片とFrameLayoutを交換しています。私の場合は

getChildFragmentManager() 
        .beginTransaction() 
        .replace(R.id.fragment_container, myFragment, MyFragment.TAG) 
        .commit(); 
+0

あなたはその動作を表示できますか? – GPack

+0

@GPack今は空です。 – Zarwan

答えて

0

を問題は、私が追加されたフラグメントビューで実際にしました。それは画面からそれを押し出す余裕があった。問題の方法は機能します。

関連する問題