【发布时间】:2016-05-07 20:29:33
【问题描述】:
我正在开发一个使用 xamarin 和 oxyplot 库的 Android 应用程序。我遇到了一个问题,我无法在 TextAnnotation 中添加多行文本。 我尝试了以下选项:
var sb = new StringBuilder();
sb.Append("Line1");
sb.AppendLine(); // which is equal to Append(Environment.NewLine);
sb.Append("\n");
sb.Append("\r\n");
sb.Append(System.Environment.NewLine);
sb.Append("Line2");
并将其添加到 TextAnnotation 文本对象中:
var textAnnotation1 = new TextAnnotation();
textAnnotation1.Text = sb.ToString();
textAnnotation1.Background = OxyColors.White;
textAnnotation1.TextColor = OxyColors.Black;
textAnnotation1.FontSize = 18;
textAnnotation1.TextPosition = new DataPoint(4,_vericalLineYaxis);
plotModel.Annotations.Add(textAnnotation1);
但一切都好用。
我的目标是让文本看起来像这样:
第 1 行
2号线
目前显示为:
1号线2号线
任何帮助将不胜感激。
【问题讨论】: