我使用以下代码来设置图形区域的大小。我已经做了一些搜索,但还没有找到将其添加到XML中的方法。
// Set size of graph area (not plot area)
final Size sm = new Size(900, SizeLayoutType.ABSOLUTE, 900, SizeLayoutType.ABSOLUTE);
myPositionLines.getGraphWidget().setSize(sm);
我如何按照图例在XML文件中做到这一点,例如:
ap:legendHeight="40dp"
感谢
(更新)从Androidplot v0.9.7开始,现在有了可样式化的属性,用于从XML控制图形小部件的大小和位置。
请记住,因为图形是一个小部件组件,所以大小/定位约定遵循所有其他Androidplot小部件的约定。查看本文档的"x/y定位小部件"one_answers"调整小部件"部分,了解其工作原理。
以下是当前可用的xml属性:
<attr name="graphHeightSizeLayoutType"/>
<attr name="graphWidthSizeLayoutType"/>
<attr name="graphHeight" format="dimension|float|integer"/>
<attr name="graphWidth" format="dimension|float|integer"/>
<attr name="graphLayoutStyleX"/>
<attr name="graphLayoutStyleY"/>
<attr name="graphPositionX" format="dimension|float|integer"/>
<attr name="graphPositionY" format="dimension|float|integer"/>
<attr name="graphAnchorPosition"/>
例如,在绘图的xml元素中添加以下内容将使图形的宽度为300dp:
ap:graphWidthSizeLayoutType="absolute"
ap:graphWidth="300dp"