I am trying to resize an ActivityIndicator (in Xamarin.Forms), but the Scale
property does not work and the HeightRequest
just crops the ActivityIndicator.
<StackLayout>
<ActivityIndicator HorizontalOptions="Center" VerticalOptions="StartAndExpand" HeightRequest="20" IsRunning="True" />
</StackLayout>
This is the result.
Any suggestions on what I might be doing wrong?
The Xamarin. Forms ActivityIndicator control displays an animation to show that the application is engaged in a lengthy activity. Unlike the ProgressBar , the ActivityIndicator gives no indication of progress. The ActivityIndicator inherits from View .
It seems sizing itself is not supported on the ActivityIndicator
. In this case, scaling is your friend.
The cutting-off you see happening is because the ActivityIndicator
is inside a StackLayout
. Because of how a StackLayout
works, it will only take up the space it needs. Since scaling doesn't necessarily make your ActivityIndicator
bigger, you have two options:
Replace your StackLayout
with a Grid
Give your ActivityIndicator
a WidthRequest
and HeightRequest
that is big enough to keep your scaled ActivityIndicator
Note: Talking about iOS here. Width and height seem to work on Android
Remove HeightRequest="20"
, it blocks your scale property.
Code should look like this
<ActivityIndicator HorizontalOptions="Center" VerticalOptions="StartAndExpand" Scale="2" IsRunning="True" />
Now, you can scale to whatever size you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With