2011-03-02 48 views
0

我想創建一個像佈局的嚮導應該看起來像描述: *在頂部應該是當前對話框的某種標題 *在底部應該是一個導航欄包含按鈕下一個/上一個和各種操作。該酒吧應該始終(!)位於屏幕的最底部。 *在中心應該是一個列表(應該使用剩下的所有空間,除了上面描述的標題欄和導航欄)嚮導喜歡在Android的佈局

我的第一次嘗試在下面發佈。我用framelayout但是我被告知這是一個壞主意。我碰到的問題是我列表的最後一行在屏幕底部的按鈕下方。你有什麼可以解決我的問題的建議嗎?

感謝

這裏是我不工作草案:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

<LinearLayout android:layout_width="fill_parent" 
     android:layout_height="wrap_content" android:orientation="vertical" > 

    <LinearLayout android:layout_width="fill_parent" 
     android:layout_height="wrap_content" android:orientation="horizontal" style="@android:style/ButtonBar"> 

     <ImageView android:src="@drawable/person" 
      android:layout_width="wrap_content" android:layout_height="wrap_content" /> 

     <TextView android:text="@string/personstring" 
      android:layout_width="wrap_content" android:layout_height="wrap_content" 
      android:textStyle="bold" android:textAppearance="?android:attr/textAppearanceLarge" /> 

    </LinearLayout> 


    <ListView android:visibility="visible" android:id="@android:id/list" 
     android:layout_width="fill_parent" android:layout_height="fill_parent" /> 


</LinearLayout> 
<LinearLayout android:id="@+id/footer" 
     android:layout_width="fill_parent" android:layout_height="wrap_content" 
     android:orientation="horizontal" android:layout_gravity="bottom|center" 
     android:layout_alignParentBottom="true" style="@android:style/ButtonBar"> 

     <ImageButton android:id="@+id/loacreation.previousButton" 
      android:layout_width="wrap_content" android:layout_height="wrap_content" 
      android:layout_weight="1" android:src="@drawable/buttonarrowleft" /> 

     <ImageButton android:id="@+id/loacreation.nextButton" 
      android:layout_width="wrap_content" android:layout_height="wrap_content" 
      android:layout_weight="1" android:src="@drawable/buttonarrowright" /> 
    </LinearLayout> 


</FrameLayout> 

回答

1

使用的RelativeLayout作爲最外層的容器,幷包含您的按鈕可以有機器人的LinearLayout中:layout_alignParentBottom =「真」。