我把这两个班级联合起来。为什么不工作?帮助我
06-14 06:35:38.250: E/AndroidRuntime(1774): FATAL EXCEPTION: main
06-14 06:35:38.250: E/AndroidRuntime(1774): Process: com.nostra13.example.universalimageloader, PID: 1774
06-14 06:35:38.250: E/AndroidRuntime(1774): android.view.InflateException: Binary XML file line #6: Error inflating class PhotoView
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
06-14 06:35:38.250: E/AndroidRuntime(1774): at com.nostra13.example.universalimageloader.ImageGridActivity$ImageAdapter.getView(ImageGridActivity.java:106)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.widget.AbsListView.obtainView(AbsListView.java:2263)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.widget.GridView.onMeasure(GridView.java:1044)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.View.measure(View.java:16497)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.View.measure(View.java:16497)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
06-14 06:35:38.250: E/AndroidRuntime(1774): at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:327)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.View.measure(View.java:16497)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
06-14 06:35:38.250: E/AndroidRuntime(1774): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.View.measure(View.java:16497)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1916)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1113)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1295)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.Choreographer.doFrame(Choreographer.java:544)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.os.Handler.handleCallback(Handler.java:733)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.os.Handler.dispatchMessage(Handler.java:95)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.os.Looper.loop(Looper.java:136)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.app.ActivityThread.main(ActivityThread.java:5017)
06-14 06:35:38.250: E/AndroidRuntime(1774): at java.lang.reflect.Method.invokeNative(Native Method)
06-14 06:35:38.250: E/AndroidRuntime(1774): at java.lang.reflect.Method.invoke(Method.java:515)
06-14 06:35:38.250: E/AndroidRuntime(1774): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-14 06:35:38.250: E/AndroidRuntime(1774): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-14 06:35:38.250: E/AndroidRuntime(1774): at dalvik.system.NativeStart.main(Native Method)
06-14 06:35:38.250: E/AndroidRuntime(1774): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.PhotoView" on path: DexPathList[[zip file "/data/app/com.nostra13.example.universalimageloader-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.nostra13.example.universalimageloader-1, /vendor/lib, /system/lib]]
06-14 06:35:38.250: E/AndroidRuntime(1774): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
06-14 06:35:38.250: E/AndroidRuntime(1774): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
06-14 06:35:38.250: E/AndroidRuntime(1774): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.LayoutInflater.createView(LayoutInflater.java:559)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:652)
06-14 06:35:38.250: E/AndroidRuntime(1774): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
06-14 06:35:38.250: E/AndroidRuntime(1774): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
06-14 06:35:38.250: E/AndroidRuntime(1774): ... 35 more
答案 0 :(得分:0)
它告诉它没有找到课程"android.view.PhotoView"
。 PhotoView
不是标准的Android视图,因此它必须是自定义视图。在XML中使用自定义视图时,必须编写如下所示的完整包名:
<com.nostra13.example.views.PhotoView
android:id="@+id/myPhotoView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
我认为PhotoView在com.nostra13.example.views
包中。