Android 如何在将片段附着到framelayout时删除空白

Android 如何在将片段附着到framelayout时删除空白,android,android-fragments,Android,Android Fragments,我的活动中有一个FrameLayout,根据NavigationDrawer中选择的项目附加片段。问题是片段没有完全填充Framelayout,尽管宽度和高度设置为与父项匹配,而且我已经尝试删除填充和边距,但空白仍然存在。下面是显示问题和xml文件的屏幕截图。如何删除空白并使贴图填充整个框架布局 活动布局: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/

我的活动中有一个FrameLayout,根据NavigationDrawer中选择的项目附加片段。问题是片段没有完全填充Framelayout,尽管宽度和高度设置为与父项匹配,而且我已经尝试删除填充和边距,但空白仍然存在。下面是显示问题和xml文件的屏幕截图。如何删除空白并使贴图填充整个框架布局

活动布局:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity">



<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@+id/tb_actionbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:elevation="4dp"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"/>


    <FrameLayout
        android:layout_margin="0dp"
        android:padding="0dp"
        android:id="@+id/container"
        android:name="com.example.styledmap.MapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

</LinearLayout>

<android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="@android:color/white"
    app:headerLayout="@layout/drawer_header"
    app:menu="@menu/drawermenu"/>

片段布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
android:id="@+id/cl_fragment"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent"
android:layout_height="match_parent">


<com.google.android.gms.maps.MapView
    android:id="@+id/google_map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<TextView
    android:id="@+id/tv_delete_marker"
    android:layout_width="match_parent"
    android:layout_height="43dp"
    android:layout_alignBottom="@id/google_map"
    android:layout_marginStart="8dp"
    android:text="@string/tv_delete"
    android:textAlignment="center"
    android:textSize="16sp"
    android:visibility="invisible"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />


<Button
    android:id="@+id/btn_add_place"
    android:layout_width="64dp"
    android:layout_height="64dp"
    android:layout_margin="16dp"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="48dp"
    android:background="@drawable/ic_add_circle_black_24dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.871"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="@+id/google_map"
    app:layout_constraintVertical_bias="0.92" />


删除



删除您在
上的
布局_margin*
属性。我必须是盲人。非常感谢你。当我不睡觉地盯着代码看的时候,我想可能会发生这种情况:)我会尽快接受你的答案
<com.google.android.gms.maps.MapView
    android:id="@+id/google_map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />