简体   繁体   中英

How to change label to layout as same as show Notification on Xamarin Forms?

I display label on screen, but string of label is too long, it hidden a part of my screen. I want custom or replace label to layout as same as Local Notifications ( https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/notifications/local-notifications#expanded-layouts )

本地通知

How to collapse long string to short string with " ... " ?

I am using Xamarin Forms version 3.4.

Please help me! Thanks!

You can use the LineBreakMode Property of Label like.

var lblDetail = new Label
    {
        LineBreakMode = LineBreakMode.TailTruncation,
        Text = "a really long string that should show 2 lines then ..."
    };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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