我尝试显示两个窗格的UI设计。我尝试在线性布局中添加两个片段并加上一个重量。但是,线性布局似乎忽略了重量。我如何改正它?由于两个片段不能在线性布局中加权?
[链接:] http://dl.dropbox.com/u/78582670/twopanes.png
我的布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<fragment
class="com.usci.view.fragment.CatalogFragment"
android:id="@+id/fragment_catalog"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.2">
</fragment>
<fragment
class="com.usci.education.TestFragment1"
android:id="@+id/fragment_test"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.8">
</fragment>
</LinearLayout>
解决方案:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<fragment
class="com.usci.view.fragment.CatalogFragment"
android:id="@+id/fragment_catalog"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="8">
</fragment>
<fragment
class="com.usci.education.TestFragment1"
android:id="@+id/fragment_test"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2">
</fragment>
</LinearLayout>
尝试给重量2,8分别 – rajpara 2012-07-30 07:37:05
尝试。但是,不是我想要的。事实上,我真的想重量第一个片段到8. – 2012-07-30 07:46:38
然后交流它,尝试和错误的家伙。 – rajpara 2012-07-30 07:47:58