title: How to insert header row on Expandable List View
body: <p>I have an Android activity with one expandable list view. Then I have created my ExpandableListAdapter, so I can click on one items and I can see the child of this item. This is ok.
  Now I want to insert a standard header (Title) for a list of child to every items. So I have build this code:</p>
  
  <pre><code>public class ResultExpandableListAdapter extends BaseExpandableListAdapter {
  
      private Context context;
      private List&lt;Result&gt; listaRisultati;
      private HashMap&lt;Integer, List&lt;ResultXResult&gt;&gt; expandableListDetail;
  
      public ResultExpandableListAdapter(Context context, List&lt;Result&gt; listaRisultati,
                                         HashMap&lt;Integer, List&lt;ResultXResult&gt;&gt; expandableListDetail) {
          this.context = context;
          this.listaRisultati = listaRisultati;
          this.expandableListDetail = expandableListDetail;
      }
  
      @Override
      public Object getChild(int listPosition, int expandedListPosition) {
          return this.expandableListDetail.get(this.listaRisultati.get(listPosition).getId())
                  .get(expandedListPosition);
      }
  
      @Override
      public long getChildId(int listPosition, int expandedListPosition) {
          return expandedListPosition;
      }
  
      @Override
      public View getChildView(int listPosition, final int expandedListPosition,
                               boolean isLastChild, View convertView, ViewGroup parent) {
  
          if (convertView == null) {
              LayoutInflater layoutInflater = (LayoutInflater) this.context
                      .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
              if(expandedListPosition ==0)
              {
                  convertView = layoutInflater.inflate(R.layout.results_x_result_list_item_header, null);
              }
  
              if(expandedListPosition&gt;0 &amp;&amp; expandedListPosition&lt;=getChildrenCount(expandedListPosition))
              {
                  ResultXResult risultato = (ResultXResult) getChild(listPosition, expandedListPosition);
                  convertView = layoutInflater.inflate(R.layout.results_x_result_list_item,null);
  
                  TextView parameter = (TextView) convertView
                          .findViewById(R.id.parameter);
  
                  TextView valueUM = (TextView) convertView
                          .findViewById(R.id.valueUm);
  
                  TextView interpretation = (TextView) convertView
                          .findViewById(R.id.interpretation);
  
                  TextView um = (TextView) convertView
                          .findViewById(R.id.um);
  
  
                  parameter.setText(risultato.getInfo().getDisplayName());
                  valueUM.setText(risultato.getValue());
                  interpretation.setText(risultato.getInterpretationCode().getDisplayName());
                  um.setText(risultato.getUnitaDiMisura());
              }
          }
  
          return convertView;
      }
  
      @Override
      public int getChildrenCount(int listPosition) {
          return this.expandableListDetail.get(this.listaRisultati.get(listPosition).getId())
                  .size();
      }
  
      @Override
      public Object getGroup(int listPosition) {
          return this.listaRisultati.get(listPosition);
      }
  
      @Override
      public int getGroupCount() {
          return this.listaRisultati.size();
      }
  
      @Override
      public long getGroupId(int listPosition) {
          return listPosition;
      }
  
      @Override
      public View getGroupView(int listPosition, boolean isExpanded,
                               View convertView, ViewGroup parent) {
          Result result = (Result) getGroup(listPosition);
          if (convertView == null) {
              LayoutInflater layoutInflater = (LayoutInflater) this.context.
                      getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = layoutInflater.inflate(R.layout.results_list_row, null);
          }
          TextView examination = (TextView) convertView
                  .findViewById(R.id.examination);
          TextView startDate = (TextView) convertView
                  .findViewById(R.id.startDate);
          TextView endDate = (TextView) convertView
                  .findViewById(R.id.endDate);
          examination.setTypeface(null, Typeface.BOLD);
  
          examination.setText(result.getInfo().getDisplayName());
          startDate.setText(result.getDateStart());
          endDate.setText(result.getDateEnd()!=null ? result.getDateEnd()+" " : " ");
          return convertView;
      }
  
      @Override
      public boolean hasStableIds() {
          return false;
      }
  
      @Override
      public boolean isChildSelectable(int listPosition, int expandedListPosition) {
          return true;
      }
  }
  </code></pre>
  
  <p>The my temporary solution is in the method "getChildView", if is the first row, I can insert one layour, if is another row, I print the data. So with this code, if I have a list of ResultXResult with 2 Items (for example), I can read only the second items.</p>
  
  <p>There is a solution of this problem, or there is another method to insert a header in child view? </p>
  
  <p>This is my app running:
  <a href="https://i.stack.imgur.com/ENMnG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ENMnG.png" alt="enter image description here"></a></p>
  
  <p>The header row for me is the yellow row "Parameter, Value...."</p>