title: LayoutManager for Recyclerview with different cell spancount
body: <p>I am working to achieve a recycler view interface that looks like this:
  <a href="https://i.stack.imgur.com/ID5SD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ID5SD.png" alt="My target interface"></a></p>
  
  <p>Presently, am only using a recyclerview with LinearLayoutManager using an adapter with two viewholders, i tried gridLayout manager too but i did not achieve the target interface: I need help achieving this, Do i have to create a custom Layout Manager? or What exactly do i have to do?  Please, I am really stuck on this.</p>
  
  <p>This is my adapter code</p>
  
  <pre><code> public class SimpleStringRecyclerViewAdapter : RecyclerView.Adapter
          {
  
              private List&lt;Data&gt; mValues;
  
  
             private Context context;
              private  const int TYPE_FULL = 0;
              private  const int TYPE_HALF = 1;
              private  const int TYPE_QUARTER = 2;
  
              public SimpleStringRecyclerViewAdapter(Context context, List&lt;Data&gt; items)
              {
                  this.context = context;
                  mValues = items;
  
              }
  
              public override int ItemCount
              {
  
                  get
                  {
                      return mValues.Count();
                  }
              }
  
              public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
              {
                  if (holder is SimpleViewHolder)
                      try
                      {
                          Data item = mValues.ElementAt(position);
  
                          var simpleHolder = holder as SimpleViewHolder;
  
                          simpleHolder.mTxtView.Text = Android.Text.Html.FromHtml(item.article.Title).ToString();
                          simpleHolder.mTxtView2.Text = item.article.Description;
  
  
                          using (var imageView = simpleHolder.mImageView)
                          {
                              string url = Android.Text.Html.FromHtml(item.article.UrlToImage).ToString();
  
                              //Download and display image
                              UrlImageViewHelper.SetUrlDrawable(imageView,
                                  url, Resource.Drawable.cheese_1
                                  );
  
  
  
                          }
                          //    simpleHolder.mprogressbar.Visibility = ViewStates.Gone;
                      }
                      catch (Exception e)
                      {
                          //Toast.MakeText(this.context, e.ToString(), ToastLength.Long).Show();
                      }
                  else
                  {
                      try
                      {
                          Data item = mValues.ElementAt(position);
                          var simpleHolder = holder as SimpleViewHolder2;
  
                          simpleHolder.mTxtView.Text = Android.Text.Html.FromHtml(item.youTubeItem.Title).ToString();
                          // simpleHolder.mTxtView2.Text = item.DescriptionShort;
  
  
                          using (var imageView = simpleHolder.mImageView)
                          {
                              string url = Android.Text.Html.FromHtml(item.youTubeItem.MaxResThumbnailUrl).ToString();
  
                              //Download and display image
                              UrlImageViewHelper.SetUrlDrawable(imageView,
                                  url, Resource.Drawable.cheese_1
                                  );
  
  
  
                          }
                      }
                      catch (Exception e)
                      {
                          //Toast.MakeText(this.context, e.ToString(), ToastLength.Long).Show();
                      }
  
                  }
              }
  
              public override int GetItemViewType(int position)
              {
                  if (mValues.ElementAt(position).type == 1)
                  {
                      return Resource.Layout.ItemsList;
                  }
  
                  else
                  {
                      return Resource.Layout.VideoList;
                  }
              }
  
  
  
              public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
              {
                  if (viewType == Resource.Layout.ItemsList)
                  {
                      View view = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.ItemsList, parent, false);
                      view.SetBackgroundColor(Color.White);
  
  
                      SimpleViewHolder holder = new SimpleViewHolder(view);
                      // holder.mprogressbar = view.FindViewById&lt;ProgressBar&gt;(Resource.Id.progressBar);
                      // holder.mprogressbar.Visibility = ViewStates.Visible;
  
  
                      //Showing loading progressbar
  
                      return holder;
                  }
                  else
                  {
                      View view = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.VideoList, parent, false);
                      view.SetBackgroundColor(Color.White);
                      SimpleViewHolder2 holder = new SimpleViewHolder2(view);
  
                      return holder;
                  }
  
              }
          }
  
          public class SimpleViewHolder : RecyclerView.ViewHolder
          {
              public string mBoundString;
              public readonly View mView;
              public readonly ImageView mImageView;
              public readonly TextView mTxtView;
              public readonly TextView mTxtView2;
              //   public ProgressBar mprogressbar;
  
  
              public SimpleViewHolder(View view) : base(view)
              {
                  mView = view;
                  mImageView = view.FindViewById&lt;ImageView&gt;(Resource.Id.avatar2);
                  mTxtView = view.FindViewById&lt;TextView&gt;(Resource.Id.Text11);
                  mTxtView2 = view.FindViewById&lt;TextView&gt;(Resource.Id.Text12);
                  //   mprogressbar = view.FindViewById&lt;ProgressBar&gt;(Resource.Id.progressBar);
  
  
              }
  
  
  
  
              public override string ToString()
              {
                  return base.ToString() + " '" + mTxtView.Text;
  
              }
          }
          public class SimpleViewHolder2 : RecyclerView.ViewHolder
          {
              public string mBoundString;
              public readonly View mView;
              public readonly ImageView mImageView;
              public readonly TextView mTxtView;
              public readonly TextView mTxtView2;
  
  
              public SimpleViewHolder2(View view) : base(view)
              {
                  mView = view;
                  mImageView = view.FindViewById&lt;ImageView&gt;(Resource.Id.videoavatar);
                  mTxtView = view.FindViewById&lt;TextView&gt;(Resource.Id.videoText1);
                  //   mprogressbar = view.FindViewById&lt;ProgressBar&gt;(Resource.Id.progressBar);
  
  
              }
          }
  </code></pre>
  
  <p>SetUpRecyclerView Method:</p>
  
  <pre><code>    dataUse = OfflineDeserializer.OfflineData(content, json2);
      recyclerView.SetLayoutManager(new LinearLayoutManager(recyclerView.Context));
      recyclerView.SetAdapter(new SimpleStringRecyclerViewAdapter(recyclerView.Context, dataUse));
      if (vp.IsShown)
      {
          vp.Visibility = ViewStates.Invisible;
  
      }
  </code></pre>
  
  <p>This is what I have presently:</p>
  
  <p><a href="https://i.stack.imgur.com/tx5Tk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tx5Tk.png" alt="I am stuck here"></a></p>