我们用fragment替换一个view时,代码如下:
Fragment1 fragment1 = new Fragment1();
transaction.replace(R.id.up_layout, fragment1);
其中up_layout设置了宽高:
<RelativeLayout
android:id="@+id/up_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="3">
</RelativeLayout>
替换后,fragment不遵从布局的宽高属性,界面混乱,如何解决?
------解决方案--------------------