如果列表視圖中有更多項目,listview將不會顯示Android layout。如果我添加4到5項目,則我的按鈕不在屏幕上。如果我使用'android:layout_alignParentBottom =「true」',那麼我的線性佈局是最後一個listview項目。當ListView中有更多項目時,Android LinearLayout不會顯示
<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>
我做了這個,但後來我的按鈕不在屏幕上。並且我看不到它們 – 2012-03-09 07:49:09
您是否已將alignParentBottom =「true」添加到底部佈局? – Demonick 2012-03-09 09:40:16
是的,我解決了這個問題,通過添加alignParentBottom =「true」到buttom佈局和應用底部邊距到列表視圖:) – 2012-03-12 06:47:21