Label display problem

JacquesBersierJacquesBersier CHMember ✭✭
edited October 2014 in Xamarin.Forms


I need to display a very long text (about 8k characters). My idea was to put a word wrapping label in a scroll view. On iOS, everything works fine. On Android, the label is cropped after about 5000 characters. If I debug label text property, the text is complete. But on the screen, it's just cut after that limit. I have tried to set the label height manually to ensure it's not a size calcultation problem. But even if height is larger, the text is not shown. Is this a bug or a known limitation of the label on Android? The only solution I found so far is to split the text in two labels. But that's just a workaround.

[EDIT]After some additionnal tests, it seems the problem is related to label height. If I use a smaller font size, I can view more text. But the height of the label is the same. What is strange is that if I set a bigger HeightRequest, the text does not fill the additional space. As if the label doesn't draw itself below a given height. The problem is the same if I use Text or FormattedText.[/EDIT]



  • MitchMilamMitchMilam USMember ✭✭✭

    @JacquesBersier‌ would it be possible to replace the label with an Editor view with the IsEnabled property set to false?

    I haven't tried it so it's just a thought.

  • JacquesBersierJacquesBersier CHMember ✭✭

    Thanks for your feedback. I tried to use an editor (as well as a webview). It doesn't cut the content and display the whole text. But it comes with other drawbacks, like the text color that changes to gray when disabled, the font that can't be changed, the height that is not resized automatically or Android that shows the entry box below the text. Using an ExtendedEntry help for some points, but a label seems much better if I can find a way to fix it.

  • RyanHatfieldOldRyanHatfieldOld USMember, Insider ✭✭✭
    edited October 2014

    Is it paragraphed? do you know how many characters you have on a line?

    I would just take the 'hacky' approach and implement line wrapping yourself, and after 10 / 100 / 1000 lines or chars move on to a new Label View, but I tend to just 'make stuff work' sometimes. There's probably a more efficient way of doing this.

    You could split every double \n\n or any \r\n\r\n (windows formatted) knowing it's a new paragraph. Or make paragraphs based on after 500 chars, find the next period and split to the next line.


  • +1 to request a more efficient/scrollable Editor/Label view that can handle long text strings!

  • ItalKItalK USMember ✭✭

    @JacquesBersier, Thanks!

  • It is a noob question, but what is LongLabel in typeof(LongLabel)?
    Should I define it somewhere ?

  • JayMartinezJayMartinez USMember

    @DanielAbrahamberg LongLabel is probably a custom class they defined. You can just replace that with Label and it should work.

  • PallaviDPallaviD USUniversity

    android:maxLines="3" is the propert which you can set through axml file

  • BartCalixtoBartCalixto USMember

    @JacquesBersier you just saved me a ton amount of time!! I was facing the same issue and doing what you suggested worked flawlessly thank you!

  • NMackayNMackay GBInsider, University mod

    @JacquesBersier @IdoTene

    Thanks for posting this, this tripped me up while doing a 3rd party licence section of an app about screen.

  • RasmusVindRasmusVind USMember ✭✭

    this is reported at
    right now the workaround like IdoTene says a costume renderer

    public class StupidTextLabelRenderer : LabelRenderer
            protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
  • MatthewRMatthewR USMember ✭✭

    Anyone have issues with long labels not displaying at all on iOS regardless of label.lines being set?

Sign In or Register to comment.