我正在尝试使用android绘图库,只需复制示例页面的代码
http://androidplot.com/docs/quickstart/
我添加库的源代码,并在示例代码中更改以下行,因为它给了我一个错误:
// Create a formatter to use for drawing a series using LineAndPointRenderer
// and configure it from xml:
LineAndPointFormatter series1Format = new LineAndPointFormatter();
series1Format.setPointLabelFormatter(new PointLabelFormatter());
series1Format.configure(getApplicationContext(),
R.xml.line_point_formatter_with_plf1);我将最后一行更改为:
R.layout.line_point_formatter_with_plf1);该程序需要几分钟的时间来编译,并给出许多错误,如下所示
Android Dex:没有附带prueba graficos的Android Dex
Android Dex: prueba graficos关联的EnclosingMethod属性。这个类可能是由一个
Android Dex: prueba graficos,没有指定任何"-target“类型选项。忽视的后果
我也有一个关于样式的错误,在这个例子中,样式是style="@ style /sample_activity“,但是我没有这个样式,所以我只是设置了布局大小。
在布局/xml/line_point_formatter_with_plf1.xml中
<?xml version="1.0" encoding="utf-8"?>
<config
linePaint.strokeWidth="3dp"
linePaint.color="#00AA00"
vertexPaint.color="#007700"
fillPaint.color="#00000000"
pointLabelFormatter.textPaint.color="#FFFFFF"/>单词config algo给我一个错误:应该定义layout_height的属性。
发布于 2013-09-07 13:41:51
实际上,您提供的教程中有一个小错误:文件line_point_formatter_plf1.xml和line_point_formatter_plf2.xml应该在res/ xml /文件夹下,如果res/文件夹下没有xml文件夹,只需创建它,它就会接受配置标签,没有问题。
这是因为您将它们放在layout/下,它认为它们是布局文件,并告诉您'config‘标记作为根标记对于布局xml文件是不可接受的。
对于"layout_height‘attribute should be defined“错误,只需添加以下两行:
android:layout_width="fill_parent"
android:layout_height="fill_parent"添加到simple_xy_plot_example.xml文件的根标记(此错误与配置标记无关)
您的simple_xy_plot_example.xml文件应如下所示:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/AppTheme"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.androidplot.xy.XYPlot
android:id="@+id/mySimpleXYPlot"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
androidPlot.title="A Simple XY Plot"
androidPlot.domainLabel="Domain"
androidPlot.rangeLabel="Range"
androidPlot.titleWidget.labelPaint.textSize="@dimen/title_font_size"
androidPlot.domainLabelWidget.labelPaint.textSize="@dimen/domain_label_font_size"
androidPlot.rangeLabelWidget.labelPaint.textSize="@dimen/range_label_font_size"
androidPlot.graphWidget.marginTop="20dp"
androidPlot.graphWidget.marginLeft="15dp"
androidPlot.graphWidget.marginBottom="25dp"
androidPlot.graphWidget.marginRight="10dp"
androidPlot.graphWidget.rangeLabelPaint.textSize="@dimen/range_tick_label_font_size"
androidPlot.graphWidget.rangeOriginLabelPaint.textSize="@dimen/range_tick_label_font_size"
androidPlot.graphWidget.domainLabelPaint.textSize="@dimen/domain_tick_label_font_size"
androidPlot.graphWidget.domainOriginLabelPaint.textSize="@dimen/domain_tick_label_font_size"
androidPlot.legendWidget.textPaint.textSize="@dimen/legend_text_font_size"
androidPlot.legendWidget.iconSizeMetrics.heightMetric.value="15dp"
androidPlot.legendWidget.iconSizeMetrics.widthMetric.value="15dp"
androidPlot.legendWidget.heightMetric.value="25dp"
androidPlot.legendWidget.positionMetrics.anchor="right_bottom"
androidPlot.graphWidget.gridLinePaint.color="#000000"/>
</LinearLayout>我试过了,它对我来说很好。
https://stackoverflow.com/questions/18669630
复制相似问题