2

我有两个片段,其中一个我想要在另一个之上,它占据了整个屏幕。我怎样才能做到这一点?

代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:opencv="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_relativelayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <fragment
        android:id="@+id/MainCameraFragment"
        android:name="com.james.skullyhud.main_camera.MainCameraFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </fragment>

    <fragment
        android:id="@+id/map"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        class="com.google.android.gms.maps.MapFragment" >
    </fragment>

</RelativeLayout>

干杯

4

2 回答 2

2
<RelativeLayout
    android:id="@+id/main_relativelayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <fragment
        android:id="@+id/map"
        class="com.google.android.gms.maps.MapFragment"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true">
    </fragment>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <fragment
            android:id="@+id/MainCameraFragment"
            android:name="com.james.skullyhud.main_camera.MainCameraFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        </fragment>
    </RelativeLayout>
</RelativeLayout>
于 2013-05-23T06:52:34.067 回答
2

这对我有帮助:

YourFragment.getView().bringToFront();
于 2014-05-14T14:24:30.980 回答