2013-07-04 38 views
0

更新:感謝大家的幫助,layout_weight是我以後的樣子。Android Java項目 - 佈局顯示不正確(按鈕在列表視圖中)

我目前正在使用java編寫我的第一個android項目。我正在嘗試使用一個線性佈局,它具有跨越大部分頁面的列表視圖,但在應用底部有一個加載更多按鈕。

這是它應該是什麼樣子,是什麼預覽我在Eclipse Previewed in Eclipse

,這是當我真正運行應用程序

When running the application

的按鈕發生了什麼有些理由是移動了很多,然後我想,我希望它堅持到頁面的底部,並讓列表視圖佔用屏幕的其餘部分...

這是我的佈局XML ...

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#000000"> 

    <ListView 
     android:id="@+id/listview" 
     android:layout_width="fill_parent" 
     android:layout_height="434dp" 
     android:maxHeight="434dp" 
     android:minHeight="434dp" 
     android:background="#000000" > 
    </ListView> 

    <Button 
     android:id="@+id/button1" 
     style="?android:attr/buttonStyleSmall" 
     android:layout_width="fill_parent" 
     android:layout_height="27dp" 
     android:maxHeight="27dp" 
     android:text="Load More..." 
     android:textSize="@dimen/dp12" /> 

</LinearLayout> 

所以我的問題是,

我做了什麼錯誤或這是需要保持的按鈕,頁面底部都沒有這樣做?

謝謝。

回答

0
<ListView 
    android:id="@+id/listview" 
    android:layout_width="fill_parent" 
    android:layout_height="0dip" 
    android:layout_weight="1.00" 
    android:background="#000000" > 
</ListView> 

<Button 
    android:id="@+id/button1" 
    style="?android:attr/buttonStyleSmall" 
    android:layout_width="fill_parent" 
    android:layout_height="27dp" 
    android:maxHeight="27dp" 
    android:text="Load More..." 
    android:textSize="@dimen/dp12" /> 
相關問題