我的背景是在navbar下。如何在导航栏下方设置背景?

问题描述:

我的背景隐藏在导航栏下。
如何将背景开始显示在导航栏下方?我的背景是在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开发,所以恐怕我无法帮到你。 –

在你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> 

如果您没有关闭您的工具栏,该视图重叠。