3

I'm making an app and I'm using fragments in an Activity, I'm switching this fragments with the replace function. The problem here is with the WebViewFragments, when replacing an existing WebViewFragment with other some times the system navigation bar becomes white...

App screens, from left to right: Normal, error, error:

App screens, from left to right: Normal, error, error

This is my layout

Activity

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical">

    <include layout="@layout/toolbar"/>

    <android.support.v4.widget.DrawerLayout
        android:id="@+id/drawerLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <FrameLayout
            android:id="@+id/contentPanel"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

        <android.support.design.widget.NavigationView
            android:id="@+id/navigationView"
            android:layout_height="match_parent"
            android:layout_width="wrap_content"
            android:layout_gravity="start"
            android:background="?colorAccent"
            app:itemTextColor="@drawable/navigation_items_color_selector"
            app:menu="@menu/menu_navigation"
            style="@style/NavigationDrawerStyle"/>

    </android.support.v4.widget.DrawerLayout>
</LinearLayout>

I'm using androids WebViewFragment so no layout there defined by me, I tried with a custom layout with the Webview as the root layout and got the same problem

The hierarchy viewer doesn't show anything abnormal

Left OK, Right Error:

Left OK, Right Error

On the equipment the navigation bar is showing white while on the hierarchy viewer it shows correctly, the letf image is without the problem, the right has the problem, no additional views.

I'm using gradle version 2.14.1 and the following support libs:

  • com.android.support:design:24.2.1
  • com.android.support:appcompat-v7:24.2.1
  • com.android.support:recyclerview-v7:24.2.1
  • com.android.support:cardview-v7:24.2.1
  • com.android.support:percent:24.2.1

Edit: forgot to mention, this happens on Android 7.0 and Android 6.0

DimaSan
  • 12,264
  • 11
  • 65
  • 75

1 Answers1

0

This was caused by the webview using the layerType as LAYER_TYPE_HARDWARE, switching it to LAYER_TYPE_SOFTWARE resolved the issue