VectorDrawable导致NumberFormatException

时间:2014-12-19 07:01:43

标签: android android-vectordrawable

我正在使用Android Lollipop的全新酷炫矢量绘图。但是对于一些SVG文件,当使用drawable时,我总是在运行时得到NumberFormatException。

这是我的stacktrace:

android.view.InflateException: Binary XML file line #60: Error inflating class android.widget.ImageButton
    at android.view.LayoutInflater.createView(LayoutInflater.java:633)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
    at censored
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:486)
    at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1073)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1166)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1372)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
    at android.view.Choreographer.doCallbacks(Choreographer.java:580)
    at android.view.Choreographer.doFrame(Choreographer.java:550)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
    at android.view.LayoutInflater.createView(LayoutInflater.java:607)
    ... 53 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-v21/example.xml from drawable resource ID #0x7f02008f
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2428)
    at android.content.res.Resources.loadDrawable(Resources.java:2330)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
    at android.widget.ImageView.<init>(ImageView.java:146)
    at android.widget.ImageButton.<init>(ImageButton.java:86)
    at android.widget.ImageButton.<init>(ImageButton.java:82)
    at android.widget.ImageButton.<init>(ImageButton.java:78)
    ... 56 more
Caused by: java.lang.NumberFormatException: Invalid float: ".4.6"
    at java.lang.StringToReal.invalidReal(StringToReal.java:63)
    at java.lang.StringToReal.initialParse(StringToReal.java:160)
    at java.lang.StringToReal.parseFloat(StringToReal.java:323)
    at java.lang.Float.parseFloat(Float.java:306)
    at android.util.PathParser.getFloats(PathParser.java:178)
    at android.util.PathParser.createNodesFromPathData(PathParser.java:59)
    at android.graphics.drawable.VectorDrawable$VFullPath.updateStateFromTypedArray(VectorDrawable.java:1439)
    at android.graphics.drawable.VectorDrawable$VFullPath.inflate(VectorDrawable.java:1421)
    at android.graphics.drawable.VectorDrawable.inflateInternal(VectorDrawable.java:542)
    at android.graphics.drawable.VectorDrawable.inflate(VectorDrawable.java:458)
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1095)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1017)
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2418)
    ... 62 more
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
    at android.view.LayoutInflater.createView(LayoutInflater.java:607)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
    at censored
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:486)
    at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1073)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1166)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1372)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
    at android.view.Choreographer.doCallbacks(Choreographer.java:580)
    at android.view.Choreographer.doFrame(Choreographer.java:550)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-v21/example.xml from drawable resource ID #0x7f02008f
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2428)
    at android.content.res.Resources.loadDrawable(Resources.java:2330)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
    at android.widget.ImageView.<init>(ImageView.java:146)
    at android.widget.ImageButton.<init>(ImageButton.java:86)
    at android.widget.ImageButton.<init>(ImageButton.java:82)
    at android.widget.ImageButton.<init>(ImageButton.java:78)
    ... 56 more
Caused by: java.lang.NumberFormatException: Invalid float: ".4.6"
    at java.lang.StringToReal.invalidReal(StringToReal.java:63)
    at java.lang.StringToReal.initialParse(StringToReal.java:160)
    at java.lang.StringToReal.parseFloat(StringToReal.java:323)
    at java.lang.Float.parseFloat(Float.java:306)
    at android.util.PathParser.getFloats(PathParser.java:178)
    at android.util.PathParser.createNodesFromPathData(PathParser.java:59)
    at android.graphics.drawable.VectorDrawable$VFullPath.updateStateFromTypedArray(VectorDrawable.java:1439)
    at android.graphics.drawable.VectorDrawable$VFullPath.inflate(VectorDrawable.java:1421)
    at android.graphics.drawable.VectorDrawable.inflateInternal(VectorDrawable.java:542)
    at android.graphics.drawable.VectorDrawable.inflate(VectorDrawable.java:458)
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1095)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1017)
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2418)
    ... 62 more
android.content.res.Resources$NotFoundException: File res/drawable-v21/example.xml from drawable resource ID #0x7f02008f
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2428)
    at android.content.res.Resources.loadDrawable(Resources.java:2330)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
    at android.widget.ImageView.<init>(ImageView.java:146)
    at android.widget.ImageButton.<init>(ImageButton.java:86)
    at android.widget.ImageButton.<init>(ImageButton.java:82)
    at android.widget.ImageButton.<init>(ImageButton.java:78)
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
    at android.view.LayoutInflater.createView(LayoutInflater.java:607)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
    at censored
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:486)
    at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1073)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1166)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1372)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
    at android.view.Choreographer.doCallbacks(Choreographer.java:580)
    at android.view.Choreographer.doFrame(Choreographer.java:550)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NumberFormatException: Invalid float: ".4.6"
    at java.lang.StringToReal.invalidReal(StringToReal.java:63)
    at java.lang.StringToReal.initialParse(StringToReal.java:160)
    at java.lang.StringToReal.parseFloat(StringToReal.java:323)
    at java.lang.Float.parseFloat(Float.java:306)
    at android.util.PathParser.getFloats(PathParser.java:178)
    at android.util.PathParser.createNodesFromPathData(PathParser.java:59)
    at android.graphics.drawable.VectorDrawable$VFullPath.updateStateFromTypedArray(VectorDrawable.java:1439)
    at android.graphics.drawable.VectorDrawable$VFullPath.inflate(VectorDrawable.java:1421)
    at android.graphics.drawable.VectorDrawable.inflateInternal(VectorDrawable.java:542)
    at android.graphics.drawable.VectorDrawable.inflate(VectorDrawable.java:458)
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1095)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1017)
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2418)
    ... 62 more
java.lang.NumberFormatException: Invalid float: ".4.6"
    at java.lang.StringToReal.invalidReal(StringToReal.java:63)
    at java.lang.StringToReal.initialParse(StringToReal.java:160)
    at java.lang.StringToReal.parseFloat(StringToReal.java:323)
    at java.lang.Float.parseFloat(Float.java:306)
    at android.util.PathParser.getFloats(PathParser.java:178)
    at android.util.PathParser.createNodesFromPathData(PathParser.java:59)
    at android.graphics.drawable.VectorDrawable$VFullPath.updateStateFromTypedArray(VectorDrawable.java:1439)
    at android.graphics.drawable.VectorDrawable$VFullPath.inflate(VectorDrawable.java:1421)
    at android.graphics.drawable.VectorDrawable.inflateInternal(VectorDrawable.java:542)
    at android.graphics.drawable.VectorDrawable.inflate(VectorDrawable.java:458)
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1095)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1017)
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2418)
    at android.content.res.Resources.loadDrawable(Resources.java:2330)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
    at android.widget.ImageView.<init>(ImageView.java:146)
    at android.widget.ImageButton.<init>(ImageButton.java:86)
    at android.widget.ImageButton.<init>(ImageButton.java:82)
    at android.widget.ImageButton.<init>(ImageButton.java:78)
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
    at android.view.LayoutInflater.createView(LayoutInflater.java:607)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
    at censored
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:486)
    at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1073)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1166)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1372)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
    at android.view.Choreographer.doCallbacks(Choreographer.java:580)
    at android.view.Choreographer.doFrame(Choreographer.java:550)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

1 个答案:

答案 0 :(得分:17)

对我而言,原因并不完全清楚,但这就是我所知道的: svg标准允许省略前导零以进行优化。这是根本原因,因为它似乎也允许连续它们,因为你喜欢0.1 0.2 0.3可以写为.1.2.3 Android的解析器不能处理这个。我所知道的所有SVG显示工具都没有问题。所以你只需要在路径中添加一些空格。我写了这个正则表达式,你可能需要多次运行,直到没有更多的命中。

只需在Android Studio(Regex复选框)中替换:

(\.\d+)(\.\d)

通过

$1 $2

这将解决您的问题。