Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Xamarin.Forms Label different behaviour

$
0
0

On IOS label which have no text does not reserve any space in the layout, but on android it does.

I created two labels with different style. If one property of bound object is set - the first label is visible, if alternate property is set, then second label is being used.

XAML:

 <StackLayout Orientation="Vertical" WidthRequest="80" >
        <StackLayout Spacing="0" Orientation="Vertical" VerticalOptions="EndAndExpand" >
            <Label Text="{Binding ThumbnailTitle}" FontSize="26" HorizontalTextAlignment="Center" LineBreakMode="NoWrap"/>
            <Label Text="{Binding ThumbnailTitleSmall}" FontSize="18" HorizontalTextAlignment="Center"/>
        </StackLayout>
        <Label Text="{Binding ThumbnailSubtitle}" VerticalOptions="StartAndExpand" LineBreakMode="NoWrap" FontSize="15" HorizontalTextAlignment="Center" />
    </StackLayout>

Thats works fine on iOS, but on Android, as you can see on screenshot, it leaves empty space at the place of empty label.

Visual Studio Community 2017 for Mac
Version 7.0.1 (build 24)

Apple Developer Tools
Xcode 8.3.3 (12175.1)

Xamarin.iOS
Version: 10.10.0.36 (Visual Studio Community)

Xamarin.Android
Version: 7.3.1.2 (Visual Studio Community)
Android SDK: /Users/ilya/Documents/android-sdk-macosx
Supported Android versions:
7.1 (API level 25)


Viewing all articles
Browse latest Browse all 91519

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>