title: Android RecyclerView Grid center items horizontally and vertically without scolling
body: <p>I want to display RecyclerView Grid items in the middle of the screen (Both horizontally and verically) and when the items expand, the view doesn't scroll, however it should resize the elements to fit the new available screen size. 
  I hope this image tells what I want in a short message:</p>
  
  <p><a href="https://i.stack.imgur.com/Pq3be.png" rel="nofollow noreferrer">Image</a></p>
  
  <p>my current code for the recycler is</p>
  
  <pre><code>    &lt;androidx.recyclerview.widget.RecyclerView
           android:padding="16dp"
           android:id="@+id/recyclerView"
           android:layout_centerInParent="true"
           android:layout_width="match_parent"
           android:layout_height="match_parent"&gt;
  
       &lt;/androidx.recyclerview.widget.RecyclerView&gt;
  </code></pre>
  
  <p>and for the item view</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;RelativeLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/container"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
  
          &lt;ImageView
              android:layout_width="54dp"
              android:layout_height="54dp"
              android:src="@mipmap/ic_launcher"
              android:layout_centerHorizontal="true"
              android:id="@+id/appIcon"
              android:layout_below="@+id/appName"
              android:contentDescription="icon" /&gt;
  
          &lt;TextView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:gravity="center"
              android:text="name"
              android:fontFamily="sans-serif-condensed"
              android:textSize="14dp"
              android:textColor="#000"
              android:singleLine="true"
              android:layout_marginTop="20dp"
              android:layout_marginBottom="5dp"
              android:layout_centerHorizontal="true"
              android:id="@+id/appName"/&gt;
  
      &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Java code:</p>
  
  <pre><code>recyclerView.setLayoutManager(new GridLayoutManager(this, 3));
      recyclerView.setHasFixedSize(true);
      recyclerView.setItemViewCacheSize(20);
      recyclerView.setDrawingCacheEnabled(true);
      recyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
      recyclerView.setAdapter(adapter);
  </code></pre>
  
  <p>Any other options other than <code>RecyclerView</code> (as GridLayout or FlexLayout) are welcomed</p>