android:FrameLayout没有在底部放置布局

Jun*_*une 0 android android-framelayout

你好Android程序员,

我试图制作一个带有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>

Run Code Online (Sandbox Code Playgroud)

然而,当我完成编码时,底部按钮栏突然出现在TOP而不是BOTTOM,如下所示.

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

我搜索了这个问题,但找不到任何可以帮助我的好文章,所以现在请教你.如果有人知道如何解决这个问题,你能帮助我吗?

谢谢阅读

Luk*_*rog 12

试试:

android:layout_gravity="bottom"
Run Code Online (Sandbox Code Playgroud)

在你的LinearLayout.