2012-03-07 45 views
0

如果列表視圖中有更多項目,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> 

回答

1

我能夠加入到alignParentBottom="true"底部佈局和應用下邊距列出像

android:layout_marginBottom="75dp" 

這樣認爲,它不會與我的底部佈局重疊,來解決這個問題。

0

添加'android:layout_alignParentTop="true"'到您的ListView和可能android:layout_below="@id/cartList"你的按鈕,如果你想ListView控件是在佈局的頂部和底部視圖也可以看到所有的時間。

+0

我做了這個,但後來我的按鈕不在屏幕上。並且我看不到它們 – 2012-03-09 07:49:09

+0

您是否已將alignParentBottom =「true」添加到底部佈局? – Demonick 2012-03-09 09:40:16

+0

是的,我解決了這個問題,通過添加alignParentBottom =「true」到buttom佈局和應用底部邊距到列表視圖:) – 2012-03-12 06:47:21

相關問題