Вопрос

Hello Android programmers,

I was trying to make a screen that has an EditText and bottom button bar with Framelayout so that my bottom button bar will remain on the bottom no matter how big the edittext will be by the user because FrameLayout makes my bottom button bar positioned on the top of the screen. Below is my code.



    <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>

However, when I finished coding, the bottom button bar suddenly appeared on the TOP not the BOTTOM like below.

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

I searched this issue but couldn't find any good articles that can help me so now ask you for advice. If anyone knows how to solve this problem, could you help me?

Thanks for reading

Это было полезно?

Решение

Try :

android:layout_gravity="bottom"

on your LinearLayout.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top