2016-07-11 69 views
1

我想在一個頁面上使用label控件顯示近300行,但我只顯示第一個頂行,我正在使用下面的代碼,我如何顯示所有行,是label合適的控件?爲什麼Xamarin.forms上的標籤不顯示所有文本?

Label testt = new Label { Text = MainPage.part1, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, FontAttributes = FontAttributes.Bold, FontSize = 24, TextColor = Color.White };   
      StackLayout stacklayout = new StackLayout 
      { 
       Children = { 
        TitleOfBook,      
        testt 

       } 
      }; 
      ScrollView scroll = new ScrollView 
      { 
       Content = stacklayout 
       ,VerticalOptions=LayoutOptions.FillAndExpand, 
       HorizontalOptions=LayoutOptions.FillAndExpand 
      }; 
      Content = scroll; 
+3

不,標籤不是適用於顯示300行文本的控件。編輯器甚至WebView將是一個更好的選擇。 – Jason

+0

@jason使用編輯器時,文本顏色顯示爲灰色。:( –

+1

WebView對我來說是更好的選擇..感謝 –

回答

2

我偶然發現了一個類似的問題。我相信問題是標籤有100行的限制(或沿着這些行)。您可以創建自定義標籤並將線路限制設置得更高。

這裏是Xamarin Forum主題的鏈接,它可能會給你一個實現的想法。

+0

我看到您的鏈接,並使用代碼.and maxline爲1000,但它仍然只顯示前100行?! –

+0

如何使用LongLabelRenderer? –

+0

我知道這有點舊,但是'[assembly:ExportRenderer(typeof(Label),typeof(LongLabelRenderer))]'這會讓你使用渲染器 –

相關問題