xamarin/Xamarin.Forms

[Bug] Label LineBreakMode not working

开放

#7,796 创建于 2019年10月3日

 (3 条评论) (0 个反应) (0 位负责人)C# (1,926 个派生)batch import
Android10e/2 :clock2:help wantedt/bug :bug:up-for-grabs

仓库指标

星标
 (5,644 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Description

Label LineBreakMode set to 'WordWrap' isn't working has expected, both for iOS and Android platforms. Words are spaned into multiple lines without hyphenation.

As it can be seen in the following image, the word "communication" is broken;

labelissue labelIssueIos

  • Version with issue: 4.2.0.709249
  • Affected Devices: It seems to be happening accross al iOS devices and on Android from API 21 to API27 (AP28 is ok, it uses hyphenization)

Reproduction Link

Here is a simple repo with a Shell navigation to a page with a single label. Play arround with the label left/right Margin to force the words to be in a break situation and observe the behavior. LabelIssue.zip

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="LabelIssue.Views.LabelPage">
    <ContentPage.Content>
        <StackLayout>
            <Label 
                Margin="20,0"
                VerticalOptions="CenterAndExpand"
                HorizontalOptions="FillAndExpand"
                HorizontalTextAlignment="Center"
                Text="Either there aren't any contents to display for now or a communication error occurred."
                LineBreakMode="WordWrap"
                FontSize="Small"
                />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

贡献者指南