扩展类android.support.v7.internal.widget.ActionBarView时出错

前端之家收集整理的这篇文章主要介绍了扩展类android.support.v7.internal.widget.ActionBarView时出错前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的应用程序正在运行,但是当我今天上午开始处理它时,一切都无法正常工作.我收到一个错误膨胀类错误,似乎是从一个xml文件,我得到“二进制 XML文件行#25”行.正如我所说,这工作正常,现在突然间没有.以下是异常跟踪:
01-27 11:20:53.624: E/AndroidRuntime(7831): FATAL EXCEPTION: main
01-27 11:20:53.624: E/AndroidRuntime(7831): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ypmmllc.dailychecklist/com.ypmmllc.dailychecklist.TabbedActivity}: android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.internal.widget.ActionBarView
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2737)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2753)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.access$2500(ActivityThread.java:129)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2107)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.os.Looper.loop(Looper.java:143)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.main(ActivityThread.java:4701)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at java.lang.reflect.Method.invokeNative(Native Method)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at java.lang.reflect.Method.invoke(Method.java:521)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at dalvik.system.NativeStart.main(Native Method)
01-27 11:20:53.624: E/AndroidRuntime(7831): Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.internal.widget.ActionBarView
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:677)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:614)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:203)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.Activity.setContentView(Activity.java:1647)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:216)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor(ActionBarActivityDelegateBase.java:180)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:134)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:76)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at com.ypmmllc.dailychecklist.TabbedActivity.onCreate(TabbedActivity.java:30)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2701)
01-27 11:20:53.624: E/AndroidRuntime(7831):     ... 11 more
01-27 11:20:53.624: E/AndroidRuntime(7831): Caused by: java.lang.reflect.InvocationTargetException
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.support.v7.internal.widget.ActionBarView.<init>(ActionBarView.java:218)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at java.lang.reflect.Constructor.constructNative(Native Method)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)

这是它在我的类中在setContentView(R.layout.activity_tabbed)上轰炸的XML文件,因为这是一切炸弹的行.

activity_tabbed.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".TabbedActivity" >


    <view class="com.ypmmllc.dailychecklist.CustomViewPager"
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </view>
</RelativeLayout>

现在我在XML文件中引用的CustomViewPager类:

package com.ypmmllc.dailychecklist;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class CustomViewPager extends ViewPager {

    private boolean enabled;

    public CustomViewPager(Context context,AttributeSet attrs) {
        super(context,attrs);
        this.enabled = false;
    }

    public CustomViewPager(Context context)
    {
        super(context);
        this.enabled = false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (this.enabled) {
            return super.onTouchEvent(event);
        }

        return false;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        if (this.enabled) {
            return super.onInterceptTouchEvent(event);
        }

        return false;
    }

    public void setPagingEnabled(boolean enabled) {
        this.enabled = enabled;
    }
}

解决方法

尝试清理项目并重建它:

IntelliJ IDEA:构建 – >重建项目;Eclipse:项目 – >清洁

原文链接:/android/312931.html

猜你在找的Android相关文章