title: How to implement custom ViewGroup in RecyclerView Adapter
body: <p>I am using a <a href="https://github.com/sayyam/carouselview" rel="nofollow noreferrer">CarouselView</a> library to show images in a RecyclerView. 
  I have created a custom view which uses  this <a href="https://github.com/chrisbanes/PhotoView" rel="nofollow noreferrer">PhotoView</a> library, to make the images zoomable.</p>
  
  <p>I need to implement a custom ViewGoup class which is explained <a href="https://github.com/chrisbanes/PhotoView#issues-with-viewgroups" rel="nofollow noreferrer">here</a>. I don't know where to change my RecyclerView Adapter, to use my <code>CustomViewGroup</code> instead of the default <code>ViewGroup</code>.</p>
  
  <p>My <code>ViewGroup</code> class looks like shown</p>
  
  <pre><code>class MyViewGroup(context: Context) : ViewGroup(context) {
  override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {}
  
  override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
      try {
          return super.onInterceptTouchEvent(ev)
      } catch (e: IllegalArgumentException) {
          e.printStackTrace()
          return false
      }
  
    }
  }
  </code></pre>
  
  <p>And this is my recyclerview adapter</p>
  
  <pre><code>class MyAdapter(
  var dataset: MutableList&lt;Upload&gt; = mutableListOf(),
  var context: Context?
  ) : RecyclerView.Adapter&lt;MyAdapter.ViewHolder&gt;() {
  
  class ViewHolder(val layout: RelativeLayout) : RecyclerView.ViewHolder(layout)
  
  override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
      val cont = LayoutInflater.from(parent.context)
          .inflate(R.layout.my_item, parent, false) as RelativeLayout
      return ViewHolder(cont)
  }
  
  
  override fun onBindViewHolder(holder: ViewHolder, position: Int) {}
  
  override fun getItemCount(): Int {
      return dataset.size
   }
  }
  </code></pre>