gpt4 book ai didi

java - 在 onCreateView 中膨胀类时出错...

转载 作者:行者123 更新时间:2023-11-29 05:31:45 26 4
gpt4 key购买 nike

我正试图摆脱一个麻烦的异常。

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.galleryphoto_fragment, null);
...

This line leads to Binary XML file line #13: Error inflating class pl.XXX.app.utils.ImageViewZoom

这个 XML 文件看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ProgressBar
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone" />

<pl.XXX.app.utils.ImageViewZoom <!-- line #13 -->
android:id="@+id/mainPhoto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="matrix" />

</FrameLayout>

我已经为您标记了第 13 行。

我尝试了什么?好吧,最初我认为这是 ImageViewZoom 错误没有正确注册,但是当从另一段代码调用时它正在工作。有人能给我指出正确的方向吗?

更新这是堆栈:

android.view.InflateException: Binary XML file line #13: Error
inflating class pl.XXX.app.utils.ImageViewZoom
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at pl.XXX.app.fragments.GalleryPhotoFragment.onCreateView(GalleryPhotoFragment.java:41)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:472)
at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1068)
at android.support.v4.view.ViewPager.populate(ViewPager.java:914)
at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:442)
at pl.XXX.app.GalleryActivity.setPhotosAdapter(GalleryActivity.java:351)
at pl.XXX.app.GalleryActivity.access$1400(GalleryActivity.java:67)
at pl.XXX.app.GalleryActivity$GetPhotos.onPostExecute(GalleryActivity.java:543)
at pl.XXX.app.GalleryActivity$GetPhotos.onPostExecute(GalleryActivity.java:518)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
... 31 more
Caused by: java.lang.NoClassDefFoundError: it.sephiroth.android.library.easing.Cubic
at it.sephiroth.android.library.imagezoom.ImageViewTouchBase.<init>(ImageViewTouchBase.java:72)
at it.sephiroth.android.library.imagezoom.ImageViewTouch.<init>(ImageViewTouch.java:42)
at pl.XXX.app.utils.ImageViewZoom.<init>(ImageViewZoom.java:21)
at pl.XXX.app.utils.ImageViewZoom.<init>(ImageViewZoom.java:17)
... 34 more

最佳答案

Caused by: java.lang.NoClassDefFoundError: it.sephiroth.android.library.easing.Cubic
at it.sephiroth.android.library.imagezoom.ImageViewTouchBase.<init>(ImageViewTouchBase.java:72)
at it.sephiroth.android.library.imagezoom.ImageViewTouch.<init>(ImageViewTouch.java:42)
at pl.XXX.app.utils.ImageViewZoom.<init>(ImageViewZoom.java:21)
at pl.XXX.app.utils.ImageViewZoom.<init>(ImageViewZoom.java:17)

您的 ImageViewZoom 构造函数最终调用了 ImageViewTouchBase 构造函数,其中 it.sephiroth.android.library.easing.Cubic 无法找到。确保代码包含在您的项目中。

关于java - 在 onCreateView 中膨胀类时出错...,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20839099/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com