如何将自定义布局设置到每个 activity 的底部

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

我正在尝试通过包含标记将按钮添加到每个 activity 的底部。但它没有与底部对齐。它在中心。以下是我在其他 activity;

底部包含的 xml

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>

所以它有什么问题。我该如何解决???

android:layout_alignParentBottom="true" 属性 添加到布局文件中的 include 标记(前提是它使用 RelativeLayout 作为父级,我建议使用它)

<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>
android:layout_alignParentBottom="true"