appcompat-v7 v21无法找到课程

时间:2014-11-26 19:39:55

标签: android xml android-appcompat android-actionbar-compat

我在setContentView(R.layout.themed_titles)上遇到了这个问题;

E/dalvikvm﹕ Could not find class 'android.support.v7.app.ActionBarActivityDelegateBase$2', referenced from method android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor
E/dalvikvm﹕ Could not find class 'android.support.v7.internal.widget.ActionBarContextView', referenced from method android.support.v7.app.ActionBarActivityDelegateBase.startSupportActionModeFromWindow
E/dalvikvm﹕ Could not find class 'android.support.v7.internal.widget.ActionBarContextView', referenced from method android.support.v7.app.ActionBarActivityDelegateBase.startSupportActionModeFromWindow
E/dalvikvm﹕ Could not find class 'android.support.v7.internal.widget.ActionBarOverlayLayout$1', referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.<init>
E/dalvikvm﹕ Could not find class 'android.support.v7.internal.widget.ActionBarOverlayLayout$1', referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.<init>
E/AndroidRuntime﹕ FATAL EXCEPTION: main
        java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.math.semhora.viewpager/viewpager.BaseActivity}: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.v7.internal.widget.ActionBarOverlayLayout

我的xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 **Line17**   xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <com.viewpagerindicator.TitlePageIndicator
        android:id="@+id/indicator"
        android:padding="10dip"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:background="#18FF0000"
        android:textColor="#AA000000"
        app:footerColor="#FFAA2222"
        app:footerLineHeight="1dp"
        app:footerIndicatorHeight="3dp"
        app:footerIndicatorStyle="underline"
        app:selectedColor="#FF000000"
        app:selectedBold="true"
        />

    <ViewStub
        android:id="@+id/vstubMain"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inflatedId="@id/no_connect"
        android:layout="@layout/no_connection" />

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="#F6F6F0" />

</LinearLayout>

在此问题出现之前,我在Log上遇到错误,要求我更改xml上的所有'app'标签,更改为'android',如果你使用的是appcompat,你应该使用android。

它正在使用appcompact v20

1 个答案:

答案 0 :(得分:1)

在我更新到appcompat v21.0.2和buildToolsVersion&#39; 21.1.1&#39;之后,它立即工作。