我是新来的android和我有一些问题。我创建了一个简单的布局有两个片段,例如如下:片段活动片段内
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/fragment1"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<FrameLayout
android:id="@+id/fragment2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
我要划分这个布局如下:1/3高度
layout_height的:
片段1的layout_height片段2:2/3高度
怎么办?
我用下面的代码显示片段1:
FragmentTransaction transaction =
getSupportFragmentManager().beginTransaction();
transaction.add(R.id.fragment1, firstfragment);
但我不知道如何表达FragmentActivity在fragment2?