title: Adding Header in ListView Android
body: <p>Currently my xml code for listview is as below:</p>
  <pre><code>&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_width=&quot;fill_parent&quot;
      android:layout_height=&quot;fill_parent&quot; &gt;
      
      &lt;ListView
          android:id=&quot;@+id/listView&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_weight=&quot;1&quot; &gt;
      &lt;/ListView&gt;
      
  
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>Now after each 5th item, I want to add a static header. So it is fixed. The xml code for the header is as below:</p>
  <pre><code>&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_width=&quot;fill_parent&quot;
      android:layout_height=&quot;fill_parent&quot; &gt;
  
      &lt;TextView  
          android:id=&quot;@+id/list_header_title&quot;  
          android:layout_width=&quot;fill_parent&quot;   
          android:layout_height=&quot;wrap_content&quot;  
          android:paddingTop=&quot;2dip&quot;  
          android:paddingBottom=&quot;2dip&quot;  
          android:background=&quot;#008000&quot;
          android:textColor=&quot;@android:color/white&quot;
          android:paddingLeft=&quot;5dip&quot;  
          style=&quot;?android:attr/listSeparatorTextViewStyle&quot; /&gt;
   &lt;/LinearLayout&gt;
  </code></pre>
  <p>Now how do I merge both? There are online articles on adding headers to list and section list view etc to do it programmatically. But mine is not so complicated.</p>
  <p>It is fixed, after every fifth item in the list view, add a header. Any idea how I could merge the both set of codes above?</p>