title: How can I set a header over a RecyclerView?
body: <p>My Android app lists the audio files inside an specific folder by using a <code>RecyclerView</code>. However, I want to display at the top of that <code>RecyclerView</code> a header that indicates the current folder with a <code>TextView</code>, but I do not know how to do it. </p>
  
  <p>Is there an easy way to achieve that?</p>
  
  <p>This is my adapter code:</p>
  
  <pre><code>package vmc.songbook;
  
  import android.content.Context;
  import android.media.MediaMetadataRetriever;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  import java.io.File;
  import java.util.Date;
  
  public class RecordingsAdapter extends RecyclerView.Adapter&lt;RecordingsAdapter.ViewHolder&gt; {
  
  // Attributes
  protected File[] files;             // Files to include in the RecyclerView
  protected LayoutInflater inflater;  // This class creates the layout based on the XML file
  
  /** Constructor */
  public RecordingsAdapter(Context context, File[] files) {
          this.files = files;
          inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      }
  
  /**  ViewHolder is needed to store the variables of each file */
  public static class ViewHolder extends RecyclerView.ViewHolder {
      public TextView file_name, file_duration, file_date;
      public ViewHolder(View itemView) {
          super(itemView);
          file_name = (TextView) itemView.findViewById(R.id.file_name);
          file_duration = (TextView) itemView.findViewById(R.id.file_duration);
          file_date = (TextView) itemView.findViewById(R.id.file_date);
      }
  }
  
  /** Inflating the ViewHolder based on the XML file*/
  @Override
  public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      View v = inflater.inflate(R.layout.file_element, null);
      return new ViewHolder(v);
  }
  
  /** Maximum number of items */
  @Override public int getItemCount() {
      return files.length;
  }
  
  /** Customizing the ViewHolder */
  @Override
  public void onBindViewHolder(ViewHolder holder, int position) {
      // Setting the date
      Date lastModDate = new Date(files[position].lastModified());
      holder.file_date.setText(lastModDate.toString());
      // Setting the audio duration
      String duration = getDuration(files[position]);
      holder.file_duration.setText(duration);
      // Setting the audio name
      holder.file_name.setText(files[position].getName());
  }
  }
  </code></pre>
  
  <p>Since I am usic a <code>Basic Activity</code> as Main Activity, my <code>content_main.xml</code> is the following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/recycler_view"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:layout_behavior="@string/appbar_scrolling_view_behavior"
  /&gt;
  </code></pre>
  
  <p>This is my current display:</p>
  
  <p><a href="https://i.stack.imgur.com/Zji6B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zji6B.png" alt="Current Display"></a></p>
  
  <p>And this is the view that what I want to achieve:</p>
  
  <p><a href="https://i.stack.imgur.com/QHaIj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QHaIj.png" alt="Wanted display"></a></p>
  
  <p>EDITED: If I create a simple TextView over the RecyclerView within a LinearLayout, the layout colocates itself over the action bar...</p>
  
  <p><a href="https://i.stack.imgur.com/JZQT8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JZQT8.png" alt="enter image description here"></a></p>