title: Android how to make custom scroll bar for recycler view
body: <p>I have a custom vertical scroll bar for recycler view, but the thumb that is used to show item position is a bit too big and an off position on when on top.</p>
  
  <p>In styles.xml I defined custom scroll bar with thumb.xml and track.xml files for custom track and thumb. In recyler.xml I added a style attribute to show the custom scroll bar, with paddings as well.</p>
  
  <p>Any ideas of how can I fix this, I tried to change width and height in thumb.xml but it does not work. Thanks!</p>
  
  <p>Styles.xml file:</p>
  
  <pre><code>&lt;resources&gt;
  &lt;style name="AppTheme" parent="@style/Theme.Leanback"&gt;
      &lt;item name="@attr/scrollbarStyle"&gt;@style/scrollbar_shape_style&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;attr name="scrollbarStyle" format="reference"/&gt;
  
  &lt;style name="scrollbar_shape_style"&gt;
      &lt;item name="android:scrollbarAlwaysDrawVerticalTrack"&gt;true&lt;/item&gt;
      &lt;item name="android:scrollbarStyle"&gt;outsideOverlay&lt;/item&gt;
      &lt;item name="android:scrollbars"&gt;vertical&lt;/item&gt;
      &lt;item name="android:fadeScrollbars"&gt;false&lt;/item&gt;
      &lt;item name="android:scrollbarThumbVertical"&gt;@drawable/thumb&lt;/item&gt;
      &lt;item name="android:scrollbarTrackVertical"&gt;@drawable/track&lt;/item&gt;
      &lt;item name="android:scrollbarSize"&gt;8dp&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p></p>
  
  <p>thumb.xml file:</p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  &lt;gradient
      android:angle="0"
      android:endColor="#ffffff"
      android:startColor="#ffffff" /&gt;
  
  &lt;corners android:radius="5dp" /&gt;
  &lt;size android:width="8dp" /&gt;
  &lt;size android:height="3dp" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>track.xml file:</p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android" &gt;
      &lt;gradient
          android:angle="0"
          android:endColor="#9BA3C5"
          android:startColor="#8388A4" /&gt;
      &lt;stroke
          android:width="7dp"
          android:color="#00ffffff"/&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>Recycler's xml file:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="383dp"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/recycler"
          style="@style/scrollbar_shape_style"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:paddingEnd="50dp"
          android:paddingStart="0dp"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>