title: Make certain items of RecyclerView use different FrameLayouts?
body: <p>I have the following adapter for a RecyclerView:</p>
  
  <pre><code>public class GreenAdapter extends RecyclerView.Adapter&lt;GreenAdapter.NumberViewHolder&gt; {
  
      private final String TAG = GreenAdapter.class.getSimpleName();
  
      private int mNumberItems;
  
      public GreenAdapter(int numberOfItems) {
          mNumberItems = numberOfItems;
      }
  
      @Override
      public NumberViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
          Context context = viewGroup.getContext();
          int layoutIdForListItem = R.layout.number_list_item;
          LayoutInflater inflater = LayoutInflater.from(context);
          boolean shouldAttachToParentImmediately = false;
  
          View view = inflater.inflate(layoutIdForListItem, viewGroup, shouldAttachToParentImmediately);
          NumberViewHolder viewHolder = new NumberViewHolder(view);
  
          return viewHolder;
      }
  
      @Override
      public void onBindViewHolder(NumberViewHolder holder, int position) {
          Log.d(TAG, "#" + position);
          holder.bind(position);
      }
  
      @Override
      public int getItemCount() {
          return mNumberItems;
      }
  
      class NumberViewHolder extends RecyclerView.ViewHolder {
  
  
          TextView listItemNumberView;
  
  
          public NumberViewHolder(View itemView) {
              super(itemView);
  
              listItemNumberView = (TextView) itemView.findViewById(R.id.TV1);
          }
  
  
          void bind(int listIndex) {
              String[] messages = getResources().getStringArray(R.array.messageArray);
               listItemNumberView.setText(messages[listIndex]);
          }
      }
  }
  </code></pre>
  
  <p>what I want to do is to make the first item of it bigger. My approach would be something like the code below, but I guess there is a better way to do it, right?</p>
  
  <pre><code>public class GreenAdapter extends RecyclerView.Adapter&lt;GreenAdapter.NumberViewHolder&gt; {
  
      boolean isFirst=true;
  
      private final String TAG = GreenAdapter.class.getSimpleName();
  
      private int mNumberItems;
  
      public GreenAdapter(int numberOfItems) {
          mNumberItems = numberOfItems;
      }
  
      @Override
      public NumberViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
          Context context = viewGroup.getContext();
          int layoutIdForListItem = R.layout.number_list_item;
          if(isFirst) {
              isFirst=false;
              layoutIdForListItem = R.layout.first;
          }
          LayoutInflater inflater = LayoutInflater.from(context);
          boolean shouldAttachToParentImmediately = false;
  
          View view = inflater.inflate(layoutIdForListItem, viewGroup, shouldAttachToParentImmediately);
          NumberViewHolder viewHolder = new NumberViewHolder(view);
  
          return viewHolder;
      }
      @Override
      public void onBindViewHolder(NumberViewHolder holder, int position) {
          Log.d(TAG, "#" + position);
          holder.bind(position);
      }
  
      @Override
      public int getItemCount() {
          return mNumberItems;
      }
  
      class NumberViewHolder extends RecyclerView.ViewHolder {
  
  
          TextView listItemNumberView;
  
  
          public NumberViewHolder(View itemView) {
              super(itemView);
  
              listItemNumberView = (TextView) itemView.findViewById(R.id.TV1);
          }
  
  
          void bind(int listIndex) {
              String[] messages = getResources().getStringArray(R.array.messageArray);
               listItemNumberView.setText(messages[listIndex]);
          }
      }
  }
  </code></pre>