我已经用 sameview 创建了 recycleview 和 framelayout(Mapfragment),但是 framelayout 总是在前面,即使它消失了

i have created recycleview and framelayout(Mapfragment) with sameview , but framelayout always in front even through its gone

我添加了我的代码,其中包含 Framelayout 与 mapview 动态创建和 RecyclerView 与另一个布局,我将其用作 FragmentViewPager fragmentstate 适配器.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <RelativeLayout
        android:id="@+id/list_item"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">  
        <android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:elevation="5dp"
            android:id="@+id/rv"
            android:layout_above="@+id/custom_progress1"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" />    
    </RelativeLayout>
    <LinearLayout
        android:id="@+id/mapLayout"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"> 
        <FrameLayout
            android:id="@+id/mapContainer"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1"/> 
    </LinearLayout> 
</RelativeLayout>

最好使用单父布局,这有助于加快 UI 渲染速度。你可以使用类似

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

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:elevation="5dp" />

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