我是刚接触android并试图在android中学习图形的创建或绘图。我遇到2个库:ANDROID上的图形/图块
- GraphView
- AndroidPlot。
我的意图是接收一些声音文件并将其绘制在图表上。所以,为了这个目的,哪个库会更好。另外我想知道,在哪里我可以看到这些库的完整实现或定义,即上述库中使用的API的结构和代码。
另外我已经尝试了一些网上可用的示例代码。但我正在寻找一个更复杂的代码,我可以在Eclipse ADT上开发,因此可以从中学习一些东西。
我是刚接触android并试图在android中学习图形的创建或绘图。我遇到2个库:ANDROID上的图形/图块
我的意图是接收一些声音文件并将其绘制在图表上。所以,为了这个目的,哪个库会更好。另外我想知道,在哪里我可以看到这些库的完整实现或定义,即上述库中使用的API的结构和代码。
另外我已经尝试了一些网上可用的示例代码。但我正在寻找一个更复杂的代码,我可以在Eclipse ADT上开发,因此可以从中学习一些东西。
如果您使用画布绘制简单的线图来绘制图形。
我的目的是获得一定的声音文件,并绘制它的图形
既不库默认做到这一点。给定一组数据点,图书馆用于绘制图表。从声音文件获取数据点取决于您。
因此,为此目的哪个库会更好。
一旦你得到数据点,任何一个库都应该没问题。
另外我想知道,在那里我可以看到这些库的完整实现或定义,即上述库中使用的API的结构和代码。
查看GraphView和AndroidPlot的来源。
我已经使用Achartengine有些时候,它的工作很好。我毫不费力地修改了它。
使用AndroidPlot。此代码绘制Vector的内容(在这种情况下,填充为零)。您只需将wav文件的信息传递给矢量。你可以检查这个线程的阅读问题。 Android: Reading wav file and displaying its values
plot = (XYPlot) findViewById(R.id.Grafica);
plot.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 0.5);
plot.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 1);
plot.getGraphWidget().getGridBackgroundPaint().setColor(Color.rgb(255, 255, 255));
plot.getGraphWidget().getDomainGridLinePaint().setColor(Color.rgb(255, 255, 255));
plot.getGraphWidget().getRangeGridLinePaint().setColor(Color.rgb(255, 255, 255));
plot.getGraphWidget().setDomainLabelPaint(null);
plot.getGraphWidget().setRangeLabelPaint(null);
plot.getGraphWidget().setDomainOriginLabelPaint(null);
plot.getGraphWidget().setRangeOriginLabelPaint(null);
plot.setBorderStyle(BorderStyle.NONE, null, null);
plot.getLayoutManager().remove(plot.getLegendWidget());
plot.getLayoutManager().remove(plot.getDomainLabelWidget());
plot.getLayoutManager().remove(plot.getRangeLabelWidget());
plot.getLayoutManager().remove(plot.getTitleWidget());
//plot.getBackgroundPaint().setColor(Color.WHITE);
//plot.getGraphWidget().getBackgroundPaint().setColor(Color.WHITE);
plot.setRangeBoundaries(-25, 25, BoundaryMode.FIXED);// check that, these //boundaries wasn't for audio files
InicializarLasVariables();
for(int i=0; i<min/11;i++){
DatoY=0;
Vector.add(DatoY);
}
XYSeries series = new SimpleXYSeries(Vector, SimpleXYSeries.ArrayFormat.Y_VALS_ONLY,"");
LineAndPointFormatter seriesFormat = new LineAndPointFormatter(Color.rgb(0, 0, 0), 0x000000, 0x000000, null);
plot.clear();
plot.addSeries(series, seriesFormat);
你在画什么? – DevZer0
我只是想在一段时间内绘制一个声音文件。你能否建议哪些库/ API是有用的。您也可以将您的回复发布到[email protected]如果可能,请提供一个ssample代码。 – user2537915