2

我正在使用BottomNavigationBar和LinearLayout作爲第一個佈局選項卡,但此頂部的意外保證金顯示我已將我的維度更改爲0dp,但沒有任何更改。LinearLayout在頂部的意外保證金

這是我的主要片段

<LinearLayout 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/container" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

    <View 
    android:id="@+id/controlView" 
    android:layout_width="match_parent" 
    android:layout_height="16dp" /> 

    <FrameLayout 
    android:id="@+id/content_frag" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" > 

</FrameLayout> 

    <android.support.design.widget.BottomNavigationView 
    android:id="@+id/navigation" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom" 
    android:background="@color/colorPrimaryDark" 
    app:menu="@menu/navigation" /> 

</LinearLayout> 

實際上存在具有相同幅度的問題兩個佈局,這是其中的一個

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:background="@color/grey_300">  

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="200dp" 
    android:background="@drawable/gcover" 
    android:id="@+id/relativeLayout"> 

    <de.hdodenhof.circleimageview.CircleImageView 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/profPhoto" 
     android:clickable="true" 
     android:layout_width="120dp" 
     android:layout_height="120dp" 
     android:padding="20dp" 
     android:src="@drawable/default_prof" 
     android:scaleType="centerCrop" 
     app:civ_border_color="@color/trans" 
     app:civ_border_width="2dp" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" /> 

</RelativeLayout> 

<LinearLayout 
    android:id="@+id/linearLayout2" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="20dp" 
    android:orientation="vertical"> 

    <android.support.v7.widget.AppCompatButton 
     android:id="@+id/prof_invite" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="150dp" 
     android:layout_marginTop="2dp" 
     android:background="@color/green_300" 
     android:drawableLeft="@drawable/icon1" 
     android:padding="12dp" 
     android:text="invite friends" /> 


    <android.support.v7.widget.AppCompatButton 
     android:id="@+id/prof_conf" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="150dp" 
     android:layout_marginTop="2dp" 
     android:background="@color/ball_D" 
     android:drawableLeft="@drawable/icon2" 
     android:padding="12dp" 
     android:text="settings" /> 

    <android.support.v7.widget.AppCompatButton 
     android:id="@+id/prof_out" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="150dp" 
     android:layout_marginTop="2dp" 
     android:background="@color/colorPrimaryDark" 
     android:drawableLeft="@drawable/icon" 
     android:padding="12dp" 
     android:text="log out" /> 

</LinearLayout> 

+0

張貼截圖相同 –

+0

截圖添加 – GGWP

回答

2
<View 
    android:id="@+id/controlView" 
    android:layout_width="match_parent" 
    android:layout_height="16dp" /> 

這是你的問題。 刪除它,它會沒事的。

+0

永遠不會注意到,謝謝! – GGWP