【发布时间】:2015-11-06 05:44:56
【问题描述】:
我是 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" />
我想将此布局划分如下:
fragment1 的布局高度:1/3 高度
fragment2 的布局高度:2/3 高度
怎么办?
我用下面的代码来显示片段1:
FragmentTransaction transaction =
getSupportFragmentManager().beginTransaction();
transaction.add(R.id.fragment1, firstfragment);
但我不知道如何在 fragment2 中显示 FragmentActivity ?
【问题讨论】:
标签: android fragment android-fragmentactivity