Android LinearLayout не отображается, когда больше элементов в ListView - PullRequest
0 голосов
/ 07 марта 2012

Макет Android не отображается после просмотра списка, если в представлении списка больше элементов. Если я добавлю 4–5 элементов, моя кнопка будет за пределами экрана. и если я использую 'android: layout_alignParentBottom = "true"', то мой линейный макет находится на последнем элементе списка.

    <RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/sereen_2_bg" >

    <ListView
        android:id="@+id/cartList"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:footerDividersEnabled="false"
         >
    </ListView>

    <LinearLayout
        android:id="@+id/linearCartFooter"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginRight="15dp"
        android:layout_marginTop="5dp"
        android:gravity="right"
        android:orientation="vertical"
        android:layout_below="@id/cartList"

        >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="right"
            android:orientation="horizontal" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/total"
                android:textColor="@color/white" />

            <TextView
                android:id="@+id/txtCartTotal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:background="@color/white"
                android:padding="3dp"
                android:text="@string/total"
                android:textColor="@color/black" />
        </LinearLayout>

        <Button
            android:id="@+id/btnCartCheckout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:background="@drawable/sereen4_submit" />
    </LinearLayout>
</RelativeLayout>

Ответы [ 2 ]

1 голос
/ 12 марта 2012

Мне удалось решить эту проблему, добавив alignParentBottom="true" к нижнему макету и применив нижнее поле к списку, как

android:layout_marginBottom="75dp"

, чтобы он не перекрывался с моим нижним расположением.

0 голосов
/ 07 марта 2012

Добавьте 'android:layout_alignParentTop="true"' к вашему ListView и, возможно, android:layout_below="@id/cartList" к вашей кнопке, если вы хотите, чтобы ListView находился в верхней части макета, а нижние представления также все время видны.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...