码迷,mamicode.com
首页 > 其他好文 > 详细

解决fragmentTransaction.replace不能全屏

时间:2014-10-20 15:11:30      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:fragmenttransaction

今天遇到个问题,使用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>


  bubuko.com,布布扣bubuko.com,布布扣

 

 

but。。。。why????

解决fragmentTransaction.replace不能全屏

标签:fragmenttransaction

原文地址:http://blog.csdn.net/leehu1987/article/details/40299935

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!