解决fragmentTransaction.replace不能全屏
今天遇到个问题,使用fragmentTransaction.replace替换后的内容不能全屏。。
FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); Fragment playFragment = new ColumnFragment(); fragmentTransaction.replace(R.id.fragment_play, playFragment); fragmentTransaction.commit();
 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#f00"
    >
    <LinearLayout
        android:background="#ccc"
        android:orientation="vertical"
        android:id="@+id/<strong>fragment_play</strong>"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    </LinearLayout>
</LinearLayout>
从网上查找了相关的资料。农民伯伯的。可是不能解决。
http://www.cnblogs.com/over140/archive/2012/07/11/2586620.html
把要替换的内容使用FrameLayout后问题解决。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#f00"
    >
    <FrameLayout
        android:background="#ccc"
        android:orientation="vertical"
        android:id="@+id/fragment_play"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    </FrameLayout>
</LinearLayout>
  
but。。。
。
why????
 
                    
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号