错误:android.view.InflateException:二进制XML文件行#26:错误膨胀类com.android.camera.CropImageView

时间:2014-06-10 09:38:08

标签: android android-imageview android-image

我的应用程序使用图像裁剪并在某些移动设备下运行,但是在使用Samsung移动版4.0或更高版本运行时,它会特别提供以下错误。完整的错误日志,如下所示。

代码 {     public class CropOptionAdapter扩展了ArrayAdapter

    private ArrayList<CropOption> mOptions;
    private LayoutInflater mInflater;

    public CropOptionAdapter(Context context, ArrayList<CropOption> options) {
        super(context, R.layout.crop_selector, options);

        mOptions    = options;

        mInflater   = LayoutInflater.from(context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup group) {
        if (convertView == null)
            convertView =  mInflater.inflate(R.layout.crop_selector, null);

        CropOption item = mOptions.get(position);

        if (item != null) {
            return convertView;
        }

        return null;

}

06-10 15:03:32.339: E/AndroidRuntime(2035): FATAL EXCEPTION: main
06-10 15:03:32.339: E/AndroidRuntime(2035): android.view.InflateException: Binary XML file         line #26: Error inflating class com.android.camera.CropImageView
06-10 15:03:32.339: E/AndroidRuntime(2035):     at                         android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at com.project.ugvcl.BillingGenerationActivity$CropOptionAdapter.getView(BillingGenerationActivity.java:3361)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.AbsListView.obtainView(AbsListView.java:2452)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.ListView.measureHeightOfChildren(ListView.java:1250)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.ListView.onMeasure(ListView.java:1161)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.View.measure(View.java:12865)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4712)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1385)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:670)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:563)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.View.measure(View.java:12865)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4712)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1385)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:670)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:563)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.View.measure(View.java:12865)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4712)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.View.measure(View.java:12865)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4712)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.View.measure(View.java:12865)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4712)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2242)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.View.measure(View.java:12865)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1240)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2628)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.os.Looper.loop(Looper.java:137)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.app.ActivityThread.main(ActivityThread.java:4517)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at java.lang.reflect.Method.invokeNative(Native Method)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at java.lang.reflect.Method.invoke(Method.java:511)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at dalvik.system.NativeStart.main(Native Method)
06-10 15:03:32.339: E/AndroidRuntime(2035): Caused by: java.lang.ClassNotFoundException: com.android.camera.CropImageView
06-10 15:03:32.339: E/AndroidRuntime(2035):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.LayoutInflater.createView(LayoutInflater.java:552)
06-10 15:03:32.339: E/AndroidRuntime(2035):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
06-10 15:03:32.339: E/AndroidRuntime(2035):     ... 40 more

1 个答案:

答案 0 :(得分:0)

您的com.android.camera.CropImageView XML布局中有crop_selector,但平台中不存在此类视图类。

(图库应用中有一个,但您不应该像这样使用它。不能保证制造商包含特定的平台应用。通常他们想用自己的应用替换它们如果你的代码有效,那只是巧合。)

如果您添加了包含CropImageView实现的库,请改用该库的实现的完整包名。