简体   繁体   English

如何在Android上使用FlowDocument?

[英]How to use FlowDocument on Android?

I have been searching for a solution, but I couldn't succeed. 我一直在寻找解决方案,但未能成功。 The problem is as follows. 问题如下。

I have a WPF application where I am using FlowDocument s. 我有一个使用FlowDocument的WPF应用程序。 I want to create a corresponding application on Android and share documents between those applications (WPF and Android) using a web service. 我想在Android上创建相应的应用程序,并使用Web服务在这些应用程序(WPF和Android)之间共享文档。

Android has SpannableString. Android具有SpannableString。 But I couldn't figure out if we have a control in Android, like RichTextBox in WPF. 但是我不知道我们是否在Android中拥有控件,例如WPF中的RichTextBox。

To sum up my question, Is there a format like Rich Text Format and an Android control to both display and manipulate this document on Android? 总结一下我的问题,是否存在像RTF 格式这样的格式和Android控件来在Android上显示和操作此文档?

You can make use of the TextView together with the span fields to set different text styles (similar to Runs on XAML). 您可以结合使用TextView和span字段来设置不同的文本样式(类似于XAML上的运行)。 There is also a SpannableStringBuilder which might ease this process. 还有一个SpannableStringBuilder可以简化此过程。

SpannableString text = new SpannableString("Hello World!")
text.setSpan(new ForegroundColorSpan(Color.BLUE), 0, 5, 0);  
text.setSpan(new StrikethroughSpan(), 7, 11, 0);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM