加权布局扩展太多。怎么解决?

时间:2017-01-05 09:54:04

标签: android layout

我制作了一份时间表清单。我使用weightsumlayout_weight,但字段太多了。如何解决它。以下是列表项There is a big space between from-to to no of seats.

的代码i =

<LinearLayout
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@layout/layout_bg_fav_bus_left"
    android:layout_weight="7"
    android:weightSum="7"
    android:gravity="left"
    android:layout_gravity="left">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:gravity="top"
        android:orientation="horizontal"
        android:layout_weight="3">
        <TextView
            android:layout_marginLeft="10dp"
            android:layout_marginTop="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20dp"
            android:textColor="@color/genaral_blue"
            android:id="@+id/txt_route"
            android:text="Route"
            android:gravity="center_vertical|center_horizontal" />

    </LinearLayout>



    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:orientation="horizontal"
        android:gravity="bottom"
        android:layout_weight="2">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/txt_avail_seats"
            android:textSize="15dp"
            android:layout_marginLeft="10dp"
            android:layout_marginBottom="2dp"
            android:textColor="@color/genaral_blue"
            android:text="Available"
            android:gravity="center_vertical|center_horizontal" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:orientation="horizontal"
        android:layout_weight="2">
        <ImageView
            android:layout_width="32dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="8dp"
            android:src="@drawable/booking"
            />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="8dp"
            android:layout_marginBottom="2dp"
            android:textColor="@color/genaral_blue"
            android:textSize="15dp"
            android:text="Book Your Seat"
            android:gravity="center_vertical" />
    </LinearLayout>

</LinearLayout>


<LinearLayout
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="3"
    android:weightSum="3"
    android:background="@layout/layout_bg_fav_bus_right"
    android:orientation="vertical"
    android:layout_gravity="right"
    android:gravity="right">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="2">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="5"
            android:id="@+id/txt_time_now"
            android:textColor="@color/alice_blue"
            android:textSize="45dp"
            android:textAlignment="center"
            android:gravity="center_vertical|center_horizontal" />

    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:weightSum="2"
        android:layout_weight="1">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAlignment="center"
            android:layout_marginBottom="3dp"
            android:text="20"
            android:id="@+id/txt_time_next1"
            android:textColor="@color/alice_blue"
            android:textSize="15dp"
            android:layout_weight="1"
            android:gravity="center_vertical|center_horizontal" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="30"
            android:layout_marginBottom="3dp"
            android:textColor="@color/alice_blue"
            android:id="@+id/txt_time_next2"
            android:textSize="15dp"
            android:layout_weight="1"
            android:gravity="center_vertical|center_horizontal" />
    </LinearLayout>

</LinearLayout>

</LinearLayout>

0 个答案:

没有答案