2017-09-23 67 views
-1

我的背景隱藏在導航欄下。
如何將背景開始顯示在導航欄下方?我的背景是在navbar下。如何在導航欄下方設置背景?

enter image description here

代碼:

<ImageView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:src="@drawable/backgroundnew" 
    android:scaleType="centerCrop" /> 
+0

也許它不在導航欄下;也許它正在裁剪?如果使用'centerInside'縮放模式會發生什麼? –

+0

它的作品,但現在背景顯示與白色條紋:D我需要全屏 – Miche

+0

我敢肯定android給你一種方法來設置你的內容背後的純色背景,但我從來沒有做過任何android開發,所以恐怕我無法幫到你。 –

回答

0

在你activity_main.xml中,你有沒有正確關閉工具欄?

<?xml version="1.0" encoding="utf-8"?> 
<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:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

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

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      android:fitsSystemWindows="true" 
      app:popupTheme="@style/AppTheme.PopupOverlay"> 
     </android.support.v7.widget.Toolbar> 

     <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     tools:showIn="@layout/app_bar_main"> 

     <FrameLayout 
      android:id="@+id/container" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"/> 
    </RelativeLayout> 
</LinearLayout> 

如果您沒有關閉您的工具欄,該視圖重疊。