如何打破一个布局?

时间:2014-11-29 11:06:00

标签: android android-layout

我有这样的布局形式;但不幸的是,最后一个textview与之前的textview重叠:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ScrollView01"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scrollbars="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center_vertical|center_horizontal"
            android:text="@string/formTitle" />

        <EditText
            android:id="@+id/requestorName"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:hint="@string/requestorname"
            android:inputType="textPersonName" >
        </EditText>

        <TextView
            android:id="@+id/requestDate"
            style="@android:style/Widget.Holo.Spinner"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:hint="@string/deliveryDate"
            android:onClick="showDatePickerDialog" />

        <Spinner
            android:id="@+id/ddlMaterials"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:entries="@array/materialList"
            android:hint="@string/material"
            android:prompt="@string/material" />

        <EditText
            android:id="@+id/txtUseOfMaterials"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:hint="@string/useOfMaterials"
            android:inputType="text" >
        </EditText>

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="5dp" >

            <EditText
                android:id="@+id/txtQuantity"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:hint="@string/quantity"
                android:inputType="number" >
            </EditText>

            <Spinner
                android:id="@+id/ddlUnits"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_toEndOf="@id/txtQuantity"
                android:layout_toRightOf="@id/txtQuantity"
                android:dropDownWidth="80dp"
                android:entries="@array/unitList"
                android:hint="@string/units"
                android:prompt="@string/units" />
        </RelativeLayout>

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="5dp" >

            <EditText
                android:id="@+id/txtCostPerUnit"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:hint="@string/costPerUnit"
                android:inputType="numberDecimal" >
            </EditText>

            <TextView
                android:id="@+id/txtTotalCost"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_toEndOf="@id/txtCostPerUnit"
                android:layout_toRightOf="@id/txtCostPerUnit"
                android:hint="@string/totalCost" />
        </RelativeLayout>

        <TextView
            android:id="@+id/txtRequisitionNo"
            android:layout_width="fill_parent"
            android:layout_height="match_parent" />
    </LinearLayout>

</ScrollView>

但最后一个textview与总费用textview重叠。我想在总费用textview之后打破。请建议。

1 个答案:

答案 0 :(得分:0)

将此视为您的上一个文字视图

   <TextView
        android:id="@+id/txtRequisitionNo"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight = "1"

/&GT;