Android2.1加载9Patch图片运行后报错

今天遇到一个很无语的问题,竟然是9Patch图片上多加了光晕效果。

因为需要自定义Button,所以请用了9Patch图片,而且图片上面还有一点光晕效果,同样也被拉伸了,在2.2的系统上面正常能跑,2.1上面就出问题,报了如下的错:

11-03 17:29:12.411: ERROR/AndroidRuntime(11390): java.lang.RuntimeException: Unable to start activity ComponentInfo{*/*}: android.view.InflateException: Binary XML file line #25: Error inflating class <unknown>
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2553)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2569)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.app.ActivityThread.access$2200(ActivityThread.java:125)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1914)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.os.Looper.loop(Looper.java:123)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.app.ActivityThread.main(ActivityThread.java:4420)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at java.lang.reflect.Method.invokeNative(Native Method)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at java.lang.reflect.Method.invoke(Method.java:521)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:924)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:682)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at dalvik.system.NativeStart.main(Native Method)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390): Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class <unknown>
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:203)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.app.Activity.setContentView(Activity.java:1622)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at *.onCreate(LocalBooksActivity.java:28)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2516)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     ... 11 more
11-03 17:29:12.411: ERROR/AndroidRuntime(11390): Caused by: java.lang.reflect.InvocationTargetException
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.widget.Button.<init>(Button.java:65)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at java.lang.reflect.Constructor.constructNative(Native Method)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.view.LayoutInflater.createView(LayoutInflater.java:500)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     ... 24 more
11-03 17:29:12.411: ERROR/AndroidRuntime(11390): Caused by: java.lang.StackOverflowError
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.content.res.StringBlock.get(StringBlock.java:69)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.content.res.AssetManager.getResourceValue(AssetManager.java:186)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.content.res.Resources.getValue(Resources.java:933)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.content.res.Resources.getDrawable(Resources.java:597)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:160)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:788)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.content.res.Resources.loadDrawable(Resources.java:1771)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.content.res.Resources.getDrawable(Resources.java:598)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:160)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:788)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.content.res.Resources.loadDrawable(Resources.java:1771)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.content.res.Resources.getDrawable(Resources.java:598)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:160)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:788)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.content.res.Resources.loadDrawable(Resources.java:1771)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.content.res.Resources.getDrawable(Resources.java:598)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:160)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:788)
11-03 17:29:12.411: ERROR/AndroidRuntime(11390):     at android.graphics.d


内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wysdws.html