gpt4 book ai didi

android - 膨胀 android.support.v4.ViewPager

转载 作者:行者123 更新时间:2023-11-29 16:00:48 25 4
gpt4 key购买 nike

尽管我已经在 stackoverflow 中尝试了当前的解决方案 HereHere ,我仍然无法解决膨胀的 ViewPager 错误。我正在使用 UniversalImageLoader 库,我想我已经以正确的方式引用了最新版本的 android.support.v4 库。在这里你可以看到我的代码和设置:

图像寻呼机类

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.ac_image_pager); //Here it returns the error below

...

ac_image_pager 布局文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:orientation="vertical" >

<android.support.v4.view.ViewPager <!--Error shows this line-->
android:id="@+id/pager"
android:layout_above="@+id/ll"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />


</RelativeLayout>

日志

07-11 14:03:05.723: E/AndroidRuntime(20969): FATAL EXCEPTION: main
07-11 14:03:05.723: E/AndroidRuntime(20969): Process: com.example.mobilyol.most, PID: 20969
07-11 14:03:05.723: E/AndroidRuntime(20969): android.view.InflateException: Binary XML file line #9: Error inflating class com.example.imageapp.ScaleImageView
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
07-11 14:03:05.723: E/AndroidRuntime(20969): at com.example.mobilyol.most.ImagePagerActivity$ImagePagerAdapter.instantiateItem(ImagePagerActivity.java:88)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:837)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.support.v4.view.ViewPager.populate(ViewPager.java:987)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.View.measure(View.java:16540)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.View.measure(View.java:16540)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5137)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.View.measure(View.java:16540)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5137)
07-11 14:03:05.723: E/AndroidRuntime(20969): at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:327)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.View.measure(View.java:16540)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5137)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
07-11 14:03:05.723: E/AndroidRuntime(20969): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.View.measure(View.java:16540)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1942)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1132)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1321)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1019)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5725)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.Choreographer.doFrame(Choreographer.java:544)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.os.Handler.handleCallback(Handler.java:733)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.os.Handler.dispatchMessage(Handler.java:95)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.os.Looper.loop(Looper.java:136)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.app.ActivityThread.main(ActivityThread.java:5086)
07-11 14:03:05.723: E/AndroidRuntime(20969): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 14:03:05.723: E/AndroidRuntime(20969): at java.lang.reflect.Method.invoke(Method.java:515)
07-11 14:03:05.723: E/AndroidRuntime(20969): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-11 14:03:05.723: E/AndroidRuntime(20969): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-11 14:03:05.723: E/AndroidRuntime(20969): at dalvik.system.NativeStart.main(Native Method)
07-11 14:03:05.723: E/AndroidRuntime(20969): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.imageapp.ScaleImageView" on path: DexPathList[[zip file "/data/app/com.example.mobilyol.most-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.mobilyol.most-2, /vendor/lib, /system/lib]]
07-11 14:03:05.723: E/AndroidRuntime(20969): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
07-11 14:03:05.723: E/AndroidRuntime(20969): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
07-11 14:03:05.723: E/AndroidRuntime(20969): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.LayoutInflater.createView(LayoutInflater.java:559)
07-11 14:03:05.723: E/AndroidRuntime(20969): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
07-11 14:03:05.723: E/AndroidRuntime(20969): ... 40 more

enter image description here

最佳答案

你的异常(exception)是:

android.view.InflateException: Binary XML file line #9: Error inflating class com.example.imageapp.ScaleImageView`

您粘贴的布局文件没有 ScaleImageView。当您使用 ViewPager 触发您的问题时,您的实际问题出在页面中,ViewPager 正在创建,这可能涉及不同的布局文件。

请确保您有一个完全限定名称为 com.example.imageapp.ScaleImageView 的类。

关于android - 膨胀 android.support.v4.ViewPager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24696456/

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