I'm looking for a way to apply a Style to an AndroidPlot element, and the documentation is precious scarce. Basically, I want to externalize the graph design elements into my styles.xml file, but I'm not sure how to do this. I've tried adding an element to Attrs.xml but to no avail.
My activity_main.xml layout file:
<com.androidplot.xy.XYPlot
android:id="@+id/main_xyplot_main"
style="@style/GraphStyle"
androidPlot.domainLabel="@string/graph_x_axis"
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.rangeLabel="@string/graph_y_axis"
androidPlot.title="@string/graph_title"
androidPlot.renderMode="use_background_thread"
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.graphWidget.gridLinePaint.color="#000000"
androidPlot.graphWidget.marginBottom="25dp"
androidPlot.graphWidget.marginLeft="20dp"
androidPlot.graphWidget.marginRight="10dp"
androidPlot.graphWidget.marginTop="20dp"
androidPlot.legendWidget.heightMetric.value="25dp"
androidPlot.legendWidget.iconSizeMetrics.heightMetric.value="15dp"
androidPlot.legendWidget.iconSizeMetrics.widthMetric.value="15dp"
androidPlot.legendWidget.positionMetrics.anchor="right_bottom"
androidPlot.legendWidget.textPaint.textSize="10dp"
android:layout_above="@id/main_percentage"
android:gravity="top"
android:visibility="invisible" />
Styles.xml
<style name="GraphStyle">
<item name="android:paddingBottom">0dp</item>
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
<item name="android:paddingTop">0dp</item>
<item name="android:layout_width">"wrap_content"</item>
<item name="android:layout_height">"wrap_content"</item>
</style>
Is there even a way to do this? I want to put all of those androidPlot.* into the GraphStyle.
Thanks!