问题描述
我有同时使用 ActionBarSherloc
k和 ViewPagerIndicator
的项目。我有一些问题,包括作为一个库,所以我落得这样做使得 ViewPagerIndicator
包括 ActionBarSherlock
作为库从 ViewPagerIndicator
删除支持V4罐子(看到这个帖子:Using ActionBarSherlock&安培; ViewPagerIndicator Syncronously不会编译)
I have a project that is using both ActionBarSherloc
k and ViewPagerIndicator
. I had some issues including both as a library, so what I ended up doing was making ViewPagerIndicator
include ActionBarSherlock
as a library and remove the support v4 jar from ViewPagerIndicator
(see this post: Using ActionBarSherlock & ViewPagerIndicator Syncronously Will Not Compile).
一切建造和我的应用程序运行,但是当我膨胀了 TabIndicator
,没有发现异常资源视图被抛出。我已经追查下来的 vpi__tab_indicator.xml
文件和6可绘制它的引用。当我注释掉那些可绘制视图膨胀罚款。我可以看到在两个 ViewPagerIndicator
这些项目可绘制,以及在我的应用程序的研究
文件。有没有办法,我失去了一些东西?有问题的活动有以下样式:安卓主题=@风格/ Theme.PageIndicatorDefaults
Everything builds and my app runs, but when I inflate a view with a TabIndicator
, a resource not found exception is thrown. I've traced it down to the vpi__tab_indicator.xml
file and the 6 drawables it's referencing. When I comment out those drawables, the view inflates fine. I can see these drawables in both the ViewPagerIndicator
project, as well as in its R
file in my application. Is there something that I'm missing? The activity in question has the following style: android:theme="@style/Theme.PageIndicatorDefaults"
编辑:结果
堆栈跟踪(如果有帮助的话)
stack trace (if it helps any)
14 07-30:48:22.391:E / AndroidRuntime(7517):致命异常:主要
07-30 14:48:22.391:E / AndroidRuntime(7517):了java.lang.RuntimeException:无法启动活动ComponentInfo {com.myapp / com.myapp.Activity}:android.content.res.Resources $ NotFoundException:文件从绘制资源ID#0x7f02005a RES /绘制/ vpi__tab_indicator.xml
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.app.ActivityThread.access $ 600(ActivityThread.java:130)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1195)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.os.Handler.dispatchMessage(Handler.java:99)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.os.Looper.loop(Looper.java:137)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.app.ActivityThread.main(ActivityThread.java:4745)
07-30 14:48:22.391:E / AndroidRuntime(7517):在java.lang.reflect.Method.invokeNative(本机方法)
07-30 14:48:22.391:E / AndroidRuntime(7517):在java.lang.reflect.Method.invoke(Method.java:511)
07-30 14:48:22.391:E / AndroidRuntime(7517):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:786)
07-30 14:48:22.391:E / AndroidRuntime(7517):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-30 14:48:22.391:E / AndroidRuntime(7517):在dalvik.system.NativeStart.main(本机方法)
07-30 14:48:22.391:E / AndroidRuntime(7517):android.content.res.Resources $ NotFoundException:通过引起了绘制资源ID#0x7f02005a文件RES /绘制/ vpi__tab_indicator.xml
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.content.res.Resources.loadDrawable(Resources.java:1918)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.content.res.TypedArray.getDrawable(TypedArray.java:601)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.view.View(View.java:3336)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.widget.TextView(TextView.java:447)
07-30 14:48:22.391:E / AndroidRuntime(7517):在com.viewpagerindicator.TabPageIndicator $ TabView的(TabPageIndicator.java:252)
07-30 14:48:22.391:E / AndroidRuntime(7517):在com.viewpagerindicator.TabPageIndicator.addTab(TabPageIndicator.java:152)
07-30 14:48:22.391:E / AndroidRuntime(7517):在com.viewpagerindicator.TabPageIndicator.notifyDataSetChanged(TabPageIndicator.java:209)
07-30 14:48:22.391:E / AndroidRuntime(7517):在com.viewpagerindicator.TabPageIndicator.setViewPager(TabPageIndicator.java:197)
07-30 14:48:22.391:E / AndroidRuntime(7517):在com.myapp.Activity.onCreate(Activity.java:27)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.app.Activity.performCreate(Activity.java:5008)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
07-30 14:48:22.391:E / AndroidRuntime(7517):11 ...更多
07-30 14:48:22.391:E / AndroidRuntime(7517):因:显示java.lang.NullPointerException
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:524)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.graphics.drawable.StateListDrawable $ StateListState.addStateSet(StateListDrawable.java:278)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:186)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:881)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.graphics.drawable.Drawable.createFromXml(Drawable.java:818)
07-30 14:48:22.391:E / AndroidRuntime(7517):在android.content.res.Resources.loadDrawable(Resources.java:1915)
谢谢!
推荐答案
在从一个地方到另一个复制文件,一对夫妇的我的 ViewPagerIndicator
可绘制的一定变得损坏一路上。我重新取从回购的可绘制,添加它们到项目中,一切编译和运行完美。
When copying files from one place to the other, a couple of my ViewPagerIndicator
drawables must have gotten corrupted along the way. I re-fetched the drawables from the repo, added them into the project, everything compiled and ran perfect.
希望这将节省别人了几个小时。
Hopefully that will save someone else a few hours.
这篇关于ViewPagerIndicator绘制资源未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!