java - 在 Android 中更改 GraphView 对象的网格颜色

标签 java android android-graphview

我添加了一个 GraphView 对象,并根据网站文档中的示例用一些数据填充了它。虽然我知道如何更改 GraphView 的背景颜色,但我不知道如何更改网格颜色。有任何想法吗?

这是我试过的:

public void createGraph(View view){
    GraphView graph = (GraphView) view.findViewById(R.id.graph);
    GridLabelRenderer gridLabelRenderer = graph.getGridLabelRenderer();

    // This works
    graph.setBackgroundColor(getResources().getColor(android.R.color.holo_green_light));

    // This does not work
    gridLabelRenderer.setGridColor(getResources().getColor(android.R.color.holo_green_light));

    // Nor does this
    //gridLabelRenderer.setGridColor(15);

    // This works
    LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(new DataPoint[] {
            new DataPoint(0, 1),
            new DataPoint(1, 5),
            new DataPoint(2, 3),
            new DataPoint(3, 2),
            new DataPoint(4, 6)
    });
    graph.addSeries(series);
}

最佳答案

关于java - 在 Android 中更改 GraphView 对象的网格颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32085210/

相关文章:

java - Tomcat7 : Issue with multiple path in shared. 加载程序

java - 根据速度或其他变量向左、向右、向上和向下滑动

android - 使用 GraphView 库 android 从 Json 数据绘制图形

java - GraphView 中的虚线

java - AndroidPlot - 从 GraphWidget 中删除域值

java - 将流写入 Excel 文件

java - 在 Eclipse 外部运行 jar 时未加载 FXML 布局

java - 为什么 JSON 存储这样的对象 {"city":[ {"com.getcity.@FAE87A"}]}

java - onClick 事件 fragment

android - 安装 PhoneGap 3.x