我如何用两种水平颜色填充屏幕,这样向下的颜色将获得屏幕的10%?(就像工具栏一样)?
我正在尝试将Linear Layout example修改为:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:text="green"
android:gravity="center_horizontal"
android:background="#00aa00"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<TextView
android:text="blue"
android:gravity="center_horizontal"
android:background="#0000aa"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:text="single row"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>但如果更改
android:layout_height="fill_parent"为
android:layout_height="wrap_content"在下面的“面板”(它是一个面板吗?)文本未显示完整。
发布于 2010-07-09 00:57:48
您将希望使用fill_parent而不是对内容进行换行,如果上半部分的权重为9,下半部分的权重为1,则9+1 = 10,1/10为10%。
https://stackoverflow.com/questions/3205554
复制相似问题