【问题标题】:Android studio showing error in graph.addSeries(series). The android studio is showing red underline in series of graph.add(series)Android Studio 在 graph.addSeries(series) 中显示错误。 android studio 在 graph.add(series) 系列中显示红色下划线
【发布时间】:2017-03-24 19:35:46
【问题描述】:

public View onCreateView(LayoutInflater inflater, ViewGroup 容器, 捆绑 savedInstanceState) {

    // Inflate the layout for this fragment
    View rootView= inflater.inflate(R.layout.fragment_graph, container, false);
    GraphView graph = (GraphView) rootView.findViewById(R.id.graph);
    BarGraphSeries<DataPoint> series = new BarGraphSeries<>(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);
    return rootView;
}

【问题讨论】:

    标签: android android-graphview


    【解决方案1】:

    我已经解决了这个错误。我只是在 build.gradle 中更改了依赖项 compile 'com.jjoe64:graphview:4.2.2' 来编译 'com.jjoe64:graphview:4.0.1' 。

    【讨论】:

      【解决方案2】:

      当前版本是 4.2.1,所以你应该把它改成

      compile 'com.jjoe64:graphview:4.2.1'

      【讨论】:

        【解决方案3】:

        我已经通过添加 Graphview.3.0.0 jar 解决了这个问题。 最初我使用的是 Graphview.4.2.1,所以出现了同样的错误,但是当我添加较低版本时,一切正常。

        【讨论】:

          猜你喜欢
          • 2015-06-10
          • 2023-01-04
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多