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

Allow label text to go over the device's width

$
0
0

I have a label on the top of my page, and I've made it into an animation where the text animates by flowing across the screen (like news on TV). When I put the label inside a stacklayout, the text is cut off based on the device's width. The text is quite long, and I want it on one line, so I put LineBreakMode to NoWrap. I changed the layout to scrollview and disabled bar visibility and it seemed to work well at first, but the text disappears at the end and after a few seconds the animation restarts, instead of flowing and restarting naturally and continuously.

This is my current code:

    <ScrollView Grid.ColumnSpan="3" BackgroundColor="Red" VerticalOptions="Start" HeightRequest="30" VerticalScrollBarVisibility="Never" HorizontalScrollBarVisibility="Never" Orientation="Horizontal" HorizontalOptions="Fill">
                <Label x:Name="MyLabel" HorizontalTextAlignment="Start" TextColor="White" LineBreakMode="NoWrap" VerticalOptions="Center" HorizontalOptions="Fill" HeightRequest="30" VerticalTextAlignment="Center" />
            </ScrollView>

`Execute = true;

        Device.StartTimer(TimeSpan.FromMilliseconds(50), () =>
        {
            topLbl.TranslationX += 2f;
            if (topLbl.TranslationX  > Width)
            {
                topLbl.TranslationX = -topLbl.Width;
            }
            return Execute;
        });`

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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