Android layout 将LinearLayout与相对线内的LinearLayout对齐

Android layout 将LinearLayout与相对线内的LinearLayout对齐,android-layout,layout,alignment,android-linearlayout,android-relativelayout,Android Layout,Layout,Alignment,Android Linearlayout,Android Relativelayout,我很难理解如何在xml文件中将层彼此对齐。 我寻找了一个解决方案,但没有找到一个适合我需要的 我在一个相亲房间里有两条直线。第一个线性布局包含RecycleView/ScrollView,第二个线性布局包含一些按钮 我想将第二个LinearLayout设置在第一个LinearLayout之上,但设置在RelativeLayout的底部。见下图 下面是我测试的内容,它将扩展第一个布局并隐藏第二个布局 <RelativeLayout xmlns:android="http://schemas.

我很难理解如何在xml文件中将层彼此对齐。 我寻找了一个解决方案,但没有找到一个适合我需要的

我在一个相亲房间里有两条直线。第一个线性布局包含RecycleView/ScrollView,第二个线性布局包含一些按钮

我想将第二个LinearLayout设置在第一个LinearLayout之上,但设置在RelativeLayout的底部。见下图

下面是我测试的内容,它将扩展第一个布局并隐藏第二个布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:id="@+id/first"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

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

</LinearLayout>

<LinearLayout
    android:id="@+id/second"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_below="@+id/first"
    android:layout_alignParentBottom="true"
    app:layout_gravity="bottom">
</LinearLayout>

</RelativeLayout>
你知道如何做到这一点吗


另外,我不想使用BottomNavigationView而不是第二个线性布局。

我设法找到了解决问题的方法。 我用框架布局更改了第一个线性布局,一切正常。请记住,第二个线性布局必须位于框架布局下。干杯