Muddy Mind
Muddy Mind

Reputation: 35

how to set the custom layout to the bottom of every activity

I am trying to add the buttons to the bottom of each activity through include tag. but it is not aligning with bottom. its about in the center. following is the xml which I am including in my bottom of other activity;

bottom_buttton_bar

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:weightSum="9"
    android:layout_gravity="bottom"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    >

    <Button
        android:layout_width="105dp"
        android:layout_height="wrap_content"
        android:layout_weight="3"
        android:id="@+id/abc"
        android:text="abc"
        android:layout_gravity="center_horizontal|bottom" />

    <Button
        android:layout_width="86dp"
        android:layout_height="wrap_content"
        android:layout_weight="3"
        android:id="@+id/aaa"
        android:text="aaa"
        android:layout_gravity="right|bottom" />

    <Button
        android:layout_width="96dp"
        android:layout_height="wrap_content"
        android:layout_weight="3"
        android:id="@+id/bbb"
        android:text="bbb"
        android:layout_gravity="left|center_vertical" />

</FrameLayout>

so what is wrong in it. How can I tackle it???

Upvotes: 0

Views: 248

Answers (2)

blueaac
blueaac

Reputation: 147

android:layout_alignParentBottom="true"

Upvotes: 0

TmKVU
TmKVU

Reputation: 3000

Add the android:layout_alignParentBottom="true" property to the include tag in your layout file (providing it is using a RelativeLayout as parent, which I would suggest to use)

<RelativeLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:layout_height="match_parent">
    <include
    layout="@layout/your_layout"
    android:layout_alignParentBottom="true"
    />
</RelativeLayout>

Upvotes: 1

Related Questions