title: Android Fragments getView returning the parent of the view?
body: <p>So I have encountered some odd behaviour when it comes to the getVIew() method in the fragment class. From the documentation I am expecting to get the view created in the onCreateView method as is stated here <a href="http://developer.android.com/reference/android/app/Fragment.html#getView()" rel="nofollow">http://developer.android.com/reference/android/app/Fragment.html#getView()</a></p>
  
  <p>"Get the root view for the fragment's layout (the one returned by onCreateView(LayoutInflater, ViewGroup, Bundle)), if provided"</p>
  
  <p>Now, I have a view that has in it a fair number of children so I wanted to try and save when i try and "findViewById" by implementing a ViewHolder class similar to the common way it is done in ListView Adapters which I set to be the tag of the view returned from the onCreateView.</p>
  
  <p>The odd behaviour occurs later when I call the getView method. It appears that the fragment is returning the parent of the view I create rather than the view I create which results in a null tag being returned. </p>
  
  <p>I wrote a small price of code to print out a view (nesting the children if the view is actually a viewGroup) and this is what I get.</p>
  
  <pre><code> android.widget.ScrollView  android.widget.ScrollView@4242dec0
   /android.widget.ScrollView 
  </code></pre>
  
  <p>and when I print it later using the getView() method I get </p>
  
  <pre><code> android.support.v4.app.NoSaveStateFrameLayout
       android.widget.ScrollView  android.widget.ScrollView@4242dec0
       /android.widget.ScrollView 
   /android.support.v4.app.NoSaveStateFrameLayout 
  </code></pre>
  
  <p>As you can see the ScrollView is the view I actually create in the onCreateView method. So why is getView returning the parent instead of the view?</p>