2017-12-24 7 views
2

Ich habe dieses seltsame Problem in meiner App passiert. Ich habe Bildansicht mit android:fitsSystemWindows="true" und will es hinter der Statusleiste kommen.Unterschiedliches Verhalten von Hintergrund und src Attribut der Bildansicht

Wenn ich android: background verwende, funktioniert es ordnungsgemäß wie erwartet, wie unten gezeigt. [Bemerken blauen Hintergrund in der Statusleiste]

enter image description here

Aber wenn ich src-Attribut verwenden, ist es nicht hinter der Statusleiste gehen.

enter image description here

bin ich etwas fehlt? Hilfe wird geschätzt.

Hier ist meine Aktivität XML.

<?xml version="1.0" encoding="utf-8"?> 
<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" 
    android:fitsSystemWindows="true" 
    tools:openDrawer="start"> 

    <ImageView 
     android:id="@+id/full_background" 
     android:fitsSystemWindows="true" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/colorPrimary" 
     android:scaleType="centerCrop" 
     android:contentDescription="full_background" 
     tools:ignore="HardcodedText" /> 

    <include 
     layout="@layout/app_bar_activity_main" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     app:headerLayout="@layout/nav_header_activity_main" 
     app:menu="@menu/activity_main_drawer" /> 

</android.support.v4.widget.DrawerLayout> 
+0

versucht, das gleiche Problem –

+0

in Ihrem Thema Fenster translucentstatus wahr oder falsch zu verlängern ?? –

+0

Es ist wahr, aber mit oder ohne es versucht, das gleiche Problem besteht aus –

Antwort

0

Versuchen Sie es mit:FLAG_LAYOUT_NO_LIMITS IT erlauben Fenster außerhalb des Bildschirms

Window window = getWindow(); 
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); 
+0

Okay, das funktionierte, aber es dauerte meine Symbolleiste in der Statusleiste. :( –

+0

okk, ich denke, ich habe es, entfernen Sie einfach alle android: fitSystemWindows = "True" außer von der Bildansicht –

+0

Nein, hat nicht funktioniert, ich muss mehr zu diesem Thema zu erforschen –

Verwandte Themen