我遇到了以下问题,
我想:
有没有办法做到这一点?
因为一张图片说的数千字以上。
答案 0 :(得分:1)
没有内置的第二轴标题,但由于它们只是TextLabelWidget
的实例,因此很容易添加自己的标题。这是一个为SimpleXYPlotActivity
示例
TextLabelWidget textLabelWidget = new TextLabelWidget(
plot.getLayoutManager(),
"some text",
null, // TextLabelWidget instances "pack" to wrap the actual text size
TextOrientation.VERTICAL_ASCENDING);
textLabelWidget.getLabelPaint().setColor(Color.RED);
textLabelWidget.getLabelPaint().setTextSize(PixelUtils.dpToPix(24));
plot.getLayoutManager().add(textLabelWidget);
textLabelWidget.position(
// add a right margin of 4dp:
PixelUtils.dpToPix(4), HorizontalPositioning.ABSOLUTE_FROM_RIGHT,
// center the text with the plot space vertically:
0, VerticalPositioning.ABSOLUTE_FROM_CENTER,
// use the middle of the right edge of the text widget as the anchor:
Anchor.RIGHT_MIDDLE);
产生: