I have to implement a layout like shown in the diagram, and I do not know the best combination to achieve the required design.
I'm designing for the 7" tablet and want the design to stretch well on the 10"
我假设像 1、2、3、4、5 这样的布局是 LinearLayout,对吗?
*活动安排是怎样的?我尝试了RelativeLayout,但我无法在布局1、2、3之间分配宽度(使用android:layout_weight)
*我在整个活动中尝试了水平线性布局,但无法将页眉和页脚布局正确添加到主水平线性布局
我阅读了文档和教程,但找不到这个复杂设计的线索,请帮助。
另外,嵌套布局对性能有何影响?
Thanks,
你可以尝试这样的事情,正如其他人所说,在这个级别你不会有性能问题
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.2"
android:background="@android:color/holo_orange_light"
android:orientation="horizontal"
android:weightSum="1" >
<View
android:id="@+id/view1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="0.2"
android:background="@android:color/black" />
<View
android:id="@+id/view2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="0.8"
android:background="@android:color/black" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.6"
android:background="@android:color/holo_blue_light"
android:orientation="horizontal"
android:weightSum="1" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:layout_weight="0.2"
android:background="@android:color/holo_purple"
android:orientation="vertical"
android:weightSum="1" >
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="0.2"
android:background="@android:color/black" />
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="0.3"
android:background="@android:color/black" />
<View
android:id="@+id/view2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="0.5"
android:background="@android:color/black" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:layout_weight="0.4"
android:background="@android:color/holo_red_dark"
android:orientation="vertical"
android:weightSum="1" >
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="0.33"
android:background="@android:color/black" />
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="0.33"
android:background="@android:color/black" />
<View
android:id="@+id/view2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="0.33"
android:background="@android:color/black" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:layout_weight="0.4"
android:background="@android:color/darker_gray"
android:orientation="vertical"
android:weightSum="1" >
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="0.5"
android:background="@android:color/black" />
<View
android:id="@+id/view2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="0.5"
android:background="@android:color/black" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.2"
android:background="@android:color/holo_green_light"
android:orientation="horizontal"
android:weightSum="1" >
<View
android:id="@+id/view1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="0.2"
android:background="@android:color/black" />
<View
android:id="@+id/view1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="0.3"
android:background="@android:color/black" />
<View
android:id="@+id/view2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="0.5"
android:background="@android:color/black" />
</LinearLayout>
</LinearLayout>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)