我有两个片段,其中一个我想要在另一个片段之上,占据整个屏幕。我怎么能这样做?
代码:
<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>
干杯
答案 0 :(得分: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>
答案 1 :(得分:2)
这对我有帮助:
YourFragment.getView().bringToFront();