activity如何让fragment出现在TabLayout下面?

How to make fragment appear below TabLayout in activity?

在我的 activity 我有:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/find_friend_fragment_container"
    tools:context="com.hb.birthpay.activity.FindFriendActivity">

        <android.support.design.widget.TabLayout
            android:id="@+id/find_friends_options_tab_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
        </android.support.design.widget.TabLayout>

</RelativeLayout>

在我的片段中我有:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:orientation="vertical"
             xmlns:app="http://schemas.android.com/apk/res-auto"
             tools:context=".fragment.SuggestedFriendsFragment">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Suggested friends"
        android:textSize="16sp"
        android:textStyle="bold"
        android:background="#f2f2f2"
        android:id="@+id/suggested_friend_text_view"
        android:height="50dp"
        android:gravity="center_vertical"
        android:paddingStart="16dp"
        android:paddingLeft="16dp" />

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/suggested_friends_recycler_view"/>

    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/find_friend_progress_bar"
        android:layout_gravity="center"/>

</LinearLayout>

我在 activity 代码中动态添加片段。现在这是它的样子:

我希望我的片段在 activity 中的 TabLayout 下方对齐。我该如何实现?

添加到新的框架布局中

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/find_friend_fragment_container"
>

<android.support.design.widget.TabLayout
    android:id="@+id/find_friends_options_tab_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
</android.support.design.widget.TabLayout>

<FrameLayout
    android:layout_below="@+id/find_friends_options_tab_layout"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</FrameLayout>
</RelativeLayout>

主要活动:

transation.replace(R.id.container,fragment);

将我的评论迁移到答案中,因为它有助于解决问题:

Change the outermost <RelativeLayout to a <LinearLayout.

简短说明:使用 <RelativeLayout> 允许重叠,而 <LinearLayout> 不是这种情况。