EdgeEffect上的UnsupportedOperationException

时间:2015-05-15 13:02:25

标签: android android-viewpager typed-arrays

初始化从xml中膨胀的ViewPager时,我的应用程序失败。以下是从Android src EdgeCompat.java

崩溃的行
final TypedArray a = context.obtainStyledAttributes(com.android.internal.R.styleable.EdgeEffect);
final int themeColor = a.getColor(com.android.internal.R.styleable.EdgeEffect_colorEdgeEffect, 0xff666666);

这由ViewPager.initViewPager()调用,我在堆栈跟踪中看到的所有内容都是在给布局膨胀时出错。

我附上了

下面的布局和堆栈跟踪

布局

<merge xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/transparent"
    android:clickable="true" >

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/transparent"
        android:overScrollMode="never" />

    <LinearLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@android:color/black" />

</merge>

堆栈跟踪

Caused by java.lang.UnsupportedOperationException
    android.content.res.TypedArray.getColor (TypedArray.java:404)
    android.widget.EdgeEffect. (EdgeEffect.java:121)
    android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect (EdgeEffectCompatIcs.java:30)
    android.support.v4.widget.EdgeEffectCompat$EdgeEffectIcsImpl.newEdgeEffect (EdgeEffectCompat.java:92)
    android.support.v4.widget.EdgeEffectCompat. (EdgeEffectCompat.java:133)
    android.support.v4.view.ViewPager.initViewPager (ViewPager.java:370)
    android.support.v4.view.ViewPager. (ViewPager.java:355)
    java.lang.reflect.Constructor.newInstance (Constructor.java)
    java.lang.reflect.Constructor.newInstance (Constructor.java:288)
    android.view.LayoutInflater.createView (LayoutInflater.java:607)
    android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:743)
    android.view.LayoutInflater.rInflate (LayoutInflater.java:806)
    android.view.LayoutInflater.inflate (LayoutInflater.java:479)
    android.view.LayoutInflater.inflate (LayoutInflater.java:414)

0 个答案:

没有答案