title: Android Fragment with CoordinatorLayout
body: <p>Here's a Activity with a ViewPager as ContentView and the adapter has 4 fragments one of them (position 2)has a CoordinatorLayout as a RootView.</p>
  
  <p>The first time I switch to the fragment , each view behaves normally, but when i switch to the last fragment(position 4, fragment of position 2's view has been destroyed.</p>
  
  <p>I have used ButterKnife to unbind the view), then switch back to fragment of position 2, the CoordinateLayout seemed to add a paddingTop automatically.</p>
  
  <p>The layouts of activity and fragment are mentioned below</p>
  
  <p>Activity layout.xml 
      </p>
  
  <pre><code>&lt;com.conjugate.fudai.views.StillViewPager
      android:id="@+id/main_pager"
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="1" /&gt;
  
  
  &lt;include layout="@layout/layout_main_navigation_bar" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>Fragment layout.xml</p>
  
  <pre><code>&lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  
  &lt;android.support.design.widget.AppBarLayout
      android:id="@+id/app_bar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;android.support.design.widget.CollapsingToolbarLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:contentScrim="@android:color/white"
          app:layout_scrollFlags="scroll|exitUntilCollapsed"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              app:layout_collapseMode="parallax"&gt;
  
              &lt;com.conjugate.fudai.views.adbanner.AdBanner
                  android:id="@+id/banner"
                  android:layout_width="match_parent"
                  android:layout_height="@dimen/main_home_banner_height" /&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="@dimen/main_home_notify_height"
                  android:background="@android:color/white"
                  android:orientation="horizontal"&gt;
  
                  &lt;ImageView
                      android:layout_width="@dimen/main_home_notify_icon_size"
                      android:layout_height="@dimen/main_home_notify_icon_size"
                      android:layout_gravity="center_vertical"
                      android:layout_marginLeft="10dp"
                      android:scaleType="centerInside"
                      android:src="@drawable/trumpet" /&gt;
  
                  &lt;TextView
                      android:id="@+id/notify"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:layout_marginLeft="8dp"
                      android:ellipsize="marquee"
                      android:focusable="true"
                      android:focusableInTouchMode="true"
                      android:gravity="center_vertical"
                      android:marqueeRepeatLimit="marquee_forever"
                      android:scrollHorizontally="true"
                      android:singleLine="true" /&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
  
          &lt;FrameLayout
              android:id="@+id/search_bar"
              android:layout_width="match_parent"
              android:layout_height="@dimen/search_bar_height"
              app:layout_collapseMode="parallax"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="horizontal"
                  android:paddingRight="10dp"&gt;
  
                  &lt;ImageView
                      android:id="@+id/search_bar_menu"
                      android:layout_width="@dimen/search_bar_icon_size"
                      android:layout_height="@dimen/search_bar_icon_size"
                      android:layout_gravity="center_vertical"
                      android:scaleType="centerInside"
                      android:src="@drawable/search_bar_menu" /&gt;
  
                  &lt;LinearLayout
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center_vertical"
                      android:layout_marginLeft="20dp"
                      android:layout_marginRight="20dp"
                      android:layout_weight="1"
                      android:background="@drawable/search_bar_search_bg"
                      android:orientation="horizontal"&gt;
  
                      &lt;ImageView
                          android:id="@+id/search_icon"
                          android:layout_width="@dimen/search_search_icon_size"
                          android:layout_height="@dimen/search_search_icon_size"
                          android:layout_gravity="center_vertical" /&gt;
  
                      &lt;TextView
                          android:id="@+id/search_text"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:padding="6dp"
                          android:text="@string/search_hint"
                          android:textColor="@android:color/white" /&gt;
  
                  &lt;/LinearLayout&gt;
  
                  &lt;ImageView
                      android:id="@+id/search_bar_msg"
                      android:layout_width="@dimen/search_bar_icon_size"
                      android:layout_height="@dimen/search_bar_icon_size"
                      android:layout_gravity="center_vertical"
                      android:scaleType="centerInside"
                      android:src="@drawable/search_bar_msg" /&gt;
  
              &lt;/LinearLayout&gt;
          &lt;/FrameLayout&gt;
  
      &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;
  &lt;/android.support.design.widget.AppBarLayout&gt;
  
  
  &lt;android.support.v7.widget.RecyclerView
      android:id="@+id/items"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;
  </code></pre>
  
  <p></p>
  
  <p><a href="https://i.stack.imgur.com/cwUsL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cwUsL.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/ykvE0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ykvE0.jpg" alt="enter image description here"></a></p>
  
  <p>Any help will be much appreciated.</p>