2011-02-01 39 views
0

我是Android开发新手。我喜欢在“分割视图”中开发应用程序(ipad具有内置框架)。我做了“WVGA800”横向模式的示例,但对于多屏幕无法解决它。示例代码:Android“拆分视图”应用程序

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
android:id="@+id/widget30" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
xmlns:android="http://schemas.android.com/apk/res/android" 
> 
<LinearLayout 
android:id="@+id/widget32" 
android:layout_width="395dp" 
android:layout_height="fill_parent" 
android:background="#ff99ff99" 
android:orientation="vertical" 
android:layout_alignBottom="@+id/widget31" 
android:layout_toRightOf="@+id/widget31" 
> 
</LinearLayout> 
<LinearLayout 
android:id="@+id/widget31" 
android:layout_width="166dp" 
android:layout_height="fill_parent" 
android:background="#ff9999ff" 
android:orientation="vertical" 
android:layout_alignParentTop="true" 
android:layout_alignParentLeft="true" 
> 
</LinearLayout> 
</RelativeLayout> 

以上是样本布局。任何人可以建议我如何修复多个屏幕的“分割视图”。

回答

4

根据我的经验,RelativeLayout的是平如果您尝试使用“toRightOf”属性(您知道,相对于那些),则不会中断。我不确定碎片是否会解决您的问题,因为它们会替换您的LinearLayouts,而不是容器,问题在哪里。

您可以使用包含两个垂直LinearLayout(或片段,如果您愿意的话)的水平LinearLayout进行此操作。您需要做的只是在用户拖动分隔栏时相互更改两个孩子的layout_weight属性(在减少另一个时增加一个)。

相关问题