使用两个Y轴时Graphview SetBackgroundColor问题

时间:2015-04-02 04:57:19

标签: java android basic4android android-graphview

我正在包装这个库,以便它可以与一个名为Basic4Android的平台一起使用,到目前为止一切都按预期工作,除了我在使用两个Y轴时设置图形背景颜色的问题,有没有人见过这个问题还是仅仅是我?

这是我的相关代码,它是我调用的设置背景颜色的函数;

        public void SetBackGroundColor(BA ba, int color){
        graphview1.getViewport().setBackgroundColor(color);
    }

我有其他功能,就像这个一样,除了我的SetBackGroundColor函数,我使用两个Y轴时它们都很好用。

我收到此错误:

  

LogCat连接到:B4A-Bridge:LGE LGLS990   java.lang.NullPointerException:尝试在空对象引用上调用虚方法'int java.lang.Integer.intValue()'       at com.jjoe64.graphview.GridLabelRenderer.getLabelVerticalSecondScaleWidth(GridLabelRenderer.java:1296)       在com.jjoe64.graphview.GraphView.getGraphContentWidth(GraphView.java:404)       在com.jjoe64.graphview.Viewport.drawFirst(Viewport.java:883)       在com.jjoe64.graphview.GraphView.onDraw(GraphView.java:295)       在android.view.View.draw(View.java:15171)       在android.view.View.updateDisplayListIfDirty(View.java:14096)       在android.view.View.getDisplayList(View.java:14119)       在android.view.View.draw(View.java:14895)       在android.view.ViewGroup.drawChild(ViewGroup.java:3405)       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:3199)       在android.view.View.updateDisplayListIfDirty(View.java:14091)       在android.view.View.getDisplayList(View.java:14119)       在android.view.View.draw(View.java:14895)       在android.view.ViewGroup.drawChild(ViewGroup.java:3405)       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:3199)       在android.view.View.draw(View.java:15174)       在android.widget.FrameLayout.draw(FrameLayout.java:592)       在android.view.View.updateDisplayListIfDirty(View.java:14096)       在android.view.View.getDisplayList(View.java:14119)       在android.view.View.draw(View.java:14895)       在android.view.ViewGroup.drawChild(ViewGroup.java:3405)       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:3199)       在android.view.View.updateDisplayListIfDirty(View.java:14091)       在android.view.View.getDisplayList(View.java:14119)       在android.view.View.draw(View.java:14895)       在android.view.ViewGroup.drawChild(ViewGroup.java:3405)       在android.view.ViewGroup.dispatchDraw(ViewGroup.java:3199)       在android.view.View.draw(View.java:15174)       在android.widget.FrameLayout.draw(FrameLayout.java:592)       在com.android.internal.policy.impl.PhoneWindow $ DecorView.draw(PhoneWindow.java:2695)       在android.view.View.updateDisplayListIfDirty(View.java:14096)       在android.view.View.getDisplayList(View.java:14119)       在android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:266)       在android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:272)       在android.view.ThreadedRenderer.draw(ThreadedRenderer.java:311)       在android.view.ViewRootImpl.draw(ViewRootImpl.java:2531)       在android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2367)       在android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1998)       在android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1078)       在android.view.ViewRootImpl $ TraversalRunnable.run(ViewRootImpl.java:5875)       在android.view.Choreographer $ CallbackRecord.run(Choreographer.java:767)       在android.view.Choreographer.doCallbacks(Choreographer.java:580)       在android.view.Choreographer.doFrame(Choreographer.java:550)       在android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:753)       在android.os.Handler.handleCallback(Handler.java:739)       在android.os.Handler.dispatchMessage(Handler.java:95)       在android.os.Looper.loop(Looper.java:135)       在android.app.ActivityThread.main(ActivityThread.java:5299)       at java.lang.reflect.Method.invoke(Native Method)       在java.lang.reflect.Method.invoke(Method.java:372)       在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:908)   〜:在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

据我所知,这个错误告诉我,我正在尝试将颜色设置为空引用,但它没有任何意义,因为所有其他功能都有效。如果我注释掉那个函数,那么一切都很好,如果我删除了第二个Y轴,那么SetBackGroundColor函数效果很好。总而言之,我认为这是图书馆的一个问题,但我不是百分百肯定,我希望有人可以帮助我阐明这个问题。

谢谢,

0 个答案:

没有答案