I added a FastScroller to my RecyclerView and used a "Bubble"-Drawable.
If I test my App on API 21, it works but if I test it on API 19, it crashes:
java.lang.RuntimeException: Unable to start activity ComponentInfo{at.guger.musixs/at.guger.musixs.ui.MainActivity}:
android.view.InflateException: Binary XML file line #15: Error inflating class at.guger.fastscroll.FastScroller ... Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class at.guger.fastscroll.FastScroller
... Caused by: java.lang.reflect.InvocationTargetException
... Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class at.guger.fastscroll.FastScrollBubble
... Caused by: java.lang.reflect.InvocationTargetException
... Caused by: android.content.res.Resources$NotFoundException: File res/drawable/bubble.xml from drawable resource ID #0x7f02004b
at android.content.res.Resources.loadDrawable(Resources.java:3457)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.view.View.(View.java:3767)
at android.view.ViewGroup.(ViewGroup.java:481)
at android.widget.FrameLayout.(FrameLayout.java:101)
at android.widget.FrameLayout.(FrameLayout.java:97)
at at.guger.fastscroll.FastScrollBubble.(FastScrollBubble.java:0)
... 38
My Bubble-XML-File:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="@dimen/bubble_corner_radius"
android:topRightRadius="@dimen/bubble_corner_radius"
android:bottomLeftRadius="@dimen/bubble_corner_radius"
android:bottomRightRadius="0dp" />
<solid android:color="?attr/colorAccent" />
<size
android:height="@dimen/bubble_size"
android:width="@dimen/bubble_size" />
</shape>
My FastScroll-Bubble-Layout:
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fastscroll_bubble"
android:layout_width="64dp"
android:layout_height="64dp"
android:background="@drawable/bubble"
android:gravity="center"
android:textSize="36sp"
tools:text="A"
tools:visibility="visible" />
My Folder-Structure: