plot.getGraph().getGridBackgroundPaint().setColor(Color.TRANSPARENT);
并将其添加到XYPlot的xml描述中:
ap:rangeLineColor="@color/ap_transparent"
最佳答案
您需要调用这两个方法(同时删除两个背景线),如果您只需要删除水平方法,则只需调用第二个方法即可。
//this removes the vertical lines
plot.getGraph().setDomainGridLinePaint(null)
//this removes the horizontal lines
plot.getGraph().setRangeGridLinePaint(null)
PS:显然,您可以传递与
null
不同的参数作为参数,以获得不同的结果。例如,您可以根据需要传递自定义Paint
对象。这是两个都设置为
null
的结果: