certificate标签xamarinforms的文本
我试图certificate Label Xamarin Forms中的 文本是合理的 ,但不能,
如何在没有使用webview的情况下certificate文本的合理性(不仅仅是造型合理)
我附上了我的代码,但它的合理性只留下了
string strText="MY LONG TEXT IS GOING HERE"; var lblMSG = new Label {TextColor = Color.Black }; lblMSG.Text=strText; lblMSG.LineBreakMode = LineBreakMode.WordWrap; lblMSG.HorizontalOptions = LayoutOptions.Fill; lblMSG.HorizontalTextAlignment = TextAlignment.Start; lblMSG.VerticalTextAlignment = TextAlignment.Center; StackLayout stk= new StackLayout { Children = { lblMSG}, BackgroundColor = Color.White ,HorizontalOptions =LayoutOptions.FillAndExpand }
而不是使用标签。 我使用了HtmlWebViewSource。
一个例子如下:
XAML:
XAML的代码(在您的情况下为viewModel.Model.Content = strText):
var browser = new WebView(); browser.HorizontalOptions = LayoutOptions.FillAndExpand; browser.VerticalOptions = LayoutOptions.FillAndExpand; var source = new HtmlWebViewSource(); var text = "" + "" + String.Format("{0}
", viewModel.Model.Content) + "" + ""; source.Html = text ; browser.Source = source; webViewLayout.Children.Add(browser);