2012-02-28 28 views
0

你好的Android程序員,安卓:FrameLayout裏並沒有把佈局在其底部

我試圖讓具有與FrameLayout裏一個EditText和底部的按鈕欄,使我的底部按鈕欄將留在屏幕底部,不管用戶編輯文本有多大,因爲FrameLayout使得我的底部按鈕欄位於屏幕的頂部。以下是我的代碼。



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

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/hello" /> 

     <EditText android:id="@+id/tm_et_date_year" android:layout_width="120px" android:layout_height="wrap_content"/> 

     <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/tm_ll_buttons" android:orientation="horizontal" 
      android:gravity="bottom"> 
      <Button android:id="@+id/tm_btn_save" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Save" android:layout_weight="1" /> 
      <Button android:id="@+id/tm_btn_cancel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Cancel" android:layout_weight="1" /> 
     </LinearLayout> 
    </FrameLayout> 

但是,當我完成編碼後,底部的按鈕欄突然出現在頂部而不是像下面那樣的底部。

http://img269.imageshack.us/img269/6374/71485552.jpg

我搜索了這個問題,但找不到任何好文章,可以幫助我所以現在問你的意見。如果有人知道如何解決這個問題,你能幫助我嗎?

感謝您閱讀

回答

11

嘗試:

android:layout_gravity="bottom" 

LinearLayout

+0

你好slukian,謝謝你的回答。我已經嘗試過,但不幸的是它沒有工作。你能給我另一個解決方案嗎? – June 2012-02-28 13:56:50

+0

糟糕。對不起slukian,當我嘗試它時出現語法錯誤。所以,現在我看到你的方法運行良好了!謝謝!! – June 2012-02-28 13:59:12

+0

你好alextsc,正如你所說,它對我來說也很好。我第一次嘗試時遇到語法錯誤,這就是爲什麼我認爲它不起作用。感謝您的努力,因爲您複製了我的所有代碼並嘗試了它!非常感謝!! – June 2012-02-28 14:04:46