2016-05-14 5 views
0

私はRecyclerViewにFastScrollerを追加し、 "Bubble" - Drawableを使用しました。DrawableはAPI 19で機能しません

私はAPI 21で私のアプリケーションをテストする場合、それは動作しますが、私はAPI 19日にそれをテストすれば、それはクラッシュ:

java.lang.RuntimeException:活動 ComponentInfo {at.gugerを開始できません。 musixs/at.guger.musixs.ui.MainActivity}:

android.view.InflateException:バイナリXMLファイルのライン#15:エラー 膨張クラスat.guger.fastscroll.FastScroller ... によって引き起こさ:アンドロイド.view.InflateException:バイナリXMLファイルの行番号15: inflating class at.guger.fastscroエラーll.FastScrollerによって引き起こさ

...:android.view.InflateException:バイナリXMLファイルのライン#6:エラー膨らまクラスat.gugerによって引き起こさにjava.lang.reflect.InvocationTargetException

...。 android.content.res.Resources $ NotFoundException:によって引き起こさにjava.lang.reflect.InvocationTargetException

... :ファイルのres /描画可能/ bubble.xmlによって引き起こさfastscroll.FastScrollBubble

... drawableリソースIDから#0x7f02004b

android.viewでandroid.content.res.Resources.loadDrawableで

(Resources.java:3457)android.content.res.TypedArray.getDrawable(TypedArray.java:602)で

。ビュー。(View.java:3767)

android.view.ViewGroupで。(ViewGroup.java:481)

android.widget.FrameLayoutで。(FrameLayout.java:101)

でandroid.widget.FrameLayout。(FrameLayout.java:9 at.guger.fastscroll.FastScrollBubbleで7)

(FastScrollBubble.java:0)

... 38

マイバブル-XML-ファイル:。

<?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-Structur E:

+0

私のXMLファイルはデフォルトのドロウアブルフォルダにありません。 –

+0

のように、互換性のないタグがあると思います... –

+0

サードパーティのライブラリを使用している場合は、作者GitHubはシナリオを提供し、問題を再現する方法についていくつかの情報を提供します。 – Leonardo

答えて

2

はあなたの問題は、これが唯一のロリポップアップからサポートされている、あなたの描画可能

<solid android:color="?attr/colorAccent" /> 

?attr/の使用です。下のすべてのバージョンでは、カラーリソースとして直接カラーを定義する必要があります。

<solid android:color="@color/colorAccent" /> 

詳細については、How to reference style attributes from a drawable?を参照してください。

+0

ありがとう!私はファストスクール全体を再建しなければならないと怖がっていたが、これは簡単だった:D –

関連する問題