title: setVisibility from View.GONE state to View.VISIBLE not working properly
body: <p>I have a real strange problem and I don't know how to solve it. 
  I have a View inside a LinearLayout with attribute android:visibility="gone"
  this is the layout file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;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="wrap_content"
      android:background="@color/bg"
      android:orientation="vertical"&gt;
  
      &lt;TextView
          android:id="@+id/titleTextView"
          android:gravity="end"
          android:text="dfgdfg"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@android:color/transparent"
          android:paddingTop="5dp"
          android:paddingBottom="5dp"/&gt;
  
      &lt;View
          android:layout_width="match_parent"
          android:layout_height="8dp"
          android:background="@drawable/shadow"
          android:id="@+id/preLollipopShadow"
          android:visibility="gone"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>when I want to change visibility of view with preLollipopShadow I use this code</p>
  
  <pre><code>if (newPosition == StickyHeaderLayoutManager.HeaderPosition.STICKY) {
                          ((ViewGroup)header).getChildAt(1).setVisibility(View.VISIBLE);
  
                      }
                      else
                      {
                          ((ViewGroup)header).getChildAt(1).setVisibility(View.GONE);
  
                      }
  </code></pre>
  
  <p>it is not working as I expect , I want that shadow be visible on sticky mode and be gone otherwise . </p>
  
  <p>how can I achieve that ?</p>
  
  <p>UPDATE 1 :
  When I start with visibility "invisible" and switch to "visible" and back it is working but not with starting state of "gone" on my preLollipopShadow view.</p>
  
  <p>UPDATE 2 : 
  The view is inside a RecyclerView , Does not updating view visibility somehow related to being nested into a RecyclerView ?  </p>