android - Viewpager + DrawerLayout + NavigationView did not display correctly -


activity_main.xml

<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/drawer_layout"     android:layout_height="match_parent"     android:layout_width="match_parent">      <framelayout         android:id="@+id/container"         android:layout_height="match_parent"         android:layout_width="match_parent"/>      <android.support.design.widget.navigationview         android:id="@+id/nav_view"         android:layout_height="match_parent"         android:layout_width="wrap_content"         android:layout_gravity="start" />  </android.support.v4.widget.drawerlayout> 

fragment_with_tab.xml

<android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:id="@+id/main_content"     android:layout_width="match_parent"     android:layout_height="match_parent">      <android.support.v4.view.viewpager         android:id="@+id/pager"         android:layout_width="match_parent"         android:layout_height="match_parent"         app:layout_behavior="@string/appbar_scrolling_view_behavior" />      <android.support.design.widget.appbarlayout         android:id="@+id/appbar"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:theme="@style/themeoverlay.appcompat.dark.actionbar"         android:background="@color/gitcafe_primary_color">          <android.support.v7.widget.toolbar             android:id="@+id/toolbar"             android:layout_width="match_parent"             android:layout_height="?attr/actionbarsize"             android:background="@color/gitcafe_primary_color"             app:popuptheme="@style/themeoverlay.appcompat.light"             app:layout_scrollflags="scroll|enteralways" />          <com.gitcafe.uibase.view.slidingtablayout             android:id="@+id/tab"             android:layout_width="match_parent"             android:layout_height="wrap_content" />      </android.support.design.widget.appbarlayout>  </android.support.design.widget.coordinatorlayout> 

i use getsupportfragmentmanager().begintransaction().replace(container, fragment).commit display fragment, drawer did not display correctly pic.

how fix problem?

screen shots: http://i.stack.imgur.com/pd2qn.png http://i.stack.imgur.com/b1beb.png

the second fragment in viewpager transparent, can see drawer under fragment.

i'm not sure why happened since i've have same structure never encountered bug.

first make sure container var pointing correct container id (i assume is, though sure).

also try setting android:fitssystemwindows="true" in drawerlayout.


Comments

Popular posts from this blog

java - BeanIO write annotated class to fixedlength -

Using Java 8 lambdas/transformations to combine and flatten two Maps -

How to connect android app to App engine -