title: ClassCastException adding header to list view (ListFragment onCreateView)
body: <p>I have a listview with a custom adapter, it renders and works fine.  The moment I try to add a header to the listview the app crashes.  My header is a seperate layout xml file it has a relative layout with two spinners one on the left and one on the right.</p>
  
  <p>I inflate the view, manipulate the spinners to add data, add it to the list view and the app no longer works when the view is created it crashes.</p>
  
  <p>Java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams.</p>
  
  <p>I am using a Fragment that extends list fragment and the xml layout just has a list in it.  The code used to add the header is in the onCreateView call,</p>
  
  <pre><code>        View view = inflater.inflate(R.layout.listview_layout, container, false);
  
          View header = (View)inflater.inflate(R.layout.header_layout, container, false);
          Spinner spinner1 = (Spinner)header.findViewById( R.id.spinner1 );
  
          //add pre-defined per page information
          ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(
                  getActivity(),
                  R.array.header_layout_spinner1, 
                  android.R.layout.simple_spinner_item
          );
          adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          spinner1.setAdapter( adapter );
  
          Integer values[] = new Integer[100];
          for(int i=1;i&lt;=100;i++)
          {
              pages[i-1] = i;
          }
  
          Spinner spinner2 = (Spinner)header.findViewById(R.id.spinner2); 
          ArrayAdapter&lt;Integer&gt; adapter2 = new ArrayAdapter&lt;Integer&gt;(getActivity(), android.R.layout.simple_spinner_item, values);
          spinner2.setAdapter(adapter2);
  
          //include header in the view
          ((ListView)view.findViewById(R.id.list)).addHeaderView(header);
  </code></pre>