[英]Xamarin Forms - WinPhone - Formatted text
My app needs to run on Android, iOS and WinPhone 8.1. 我的应用程序需要在Android,iOS和WinPhone 8.1上运行。 It needs to have a page with a long text that include a lot of format:
它需要一个带有长文本的页面,其中包含许多格式:
bold 胆大
bullet list 项目符号清单
link (http, mail, phone) 链接(http,邮件,电话)
Because it has to run on all 3 platforms, I tried to create an HTML string in order to send it to a WebView like this : 因为它必须在所有3个平台上运行,所以我尝试创建一个HTML字符串以将其发送到这样的WebView:
MyWebView.Source = new HtmlWebViewSource {Html = stringHtml };
So I can use <b>
for bolds, <ul>
for bullet lists, <a>
for links. 因此,我可以将
<b>
用作粗体,将<ul>
用作项目符号列表,将<a>
用作链接。
Because I need also a custom font and specific size, in my html string there is a new style with all these the informations. 因为我还需要自定义字体和特定大小,所以在我的html字符串中,所有这些信息都有一种新样式。
It works.... but with 2 problems on Windows Phone: 它可以工作...。但是在Windows Phone上有2个问题:
Any idea about these problems? 对这些问题有任何想法吗?
And if there's another solution different from WebView... it's welcome! 而且,如果还有不同于WebView的解决方案,欢迎您!
Xamarin.Forms includes a FormattedText property in the Label (this guide should help you to understand it: Xamarin.Forms FormattedText ). Xamarin.Forms在Label中包含FormattedText属性(本指南应帮助您理解它: Xamarin.Forms FormattedText )。 But there are some things you want to do that can't be done with it, and these are:
但是有些事情您想做不到,而这些事情是:
The rest of what you want (bold, italic, color changes, etc.) FormattedText has. 您想要的其余内容(粗体,斜体,颜色更改等)都具有FormattedText。
Hope it helps! 希望能帮助到你! :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.