如何在Xamarin.Forms MacOs中更改ActivityIndi​​cator的颜色?

时间:2018-07-14 03:06:09

标签: macos colors xamarin.forms activity-indicator

我有以下代码:

ActivityIndicator activityIndicator = new ActivityIndicator
        {
            Color = Color.LightGreen,
            IsVisible = true,
            IsRunning = true,
            VerticalOptions = LayoutOptions.CenterAndExpand,
        };

它在Android,iOs,UWP上正常运行,但是在MAC上存在一个扩展问题,ActivityIndi​​cator第一次显示时显示正常:

enter image description here

但是第二次使用该应用程序的所有ActivityIndi​​cators颜色不同(黑色)时,有什么想法吗?

enter image description here

1 个答案:

答案 0 :(得分:0)

您是否尝试过全局设置?

App.xaml

<prism:PrismApplication.Resources>
    <ResourceDictionary>
            <Style x:Key="ActivityIndicator" TargetType="ActivityIndicator">
            <Setter Property="IsVisible" Value="true" />
            <Setter Property="IsRunning" Value="true" />
            <Setter Property="VerticalOptions" Value="CenterAndExpand" />
            <Setter Property="Color" Value="Color.LightGreen" />
        </Style>
    </ResourceDictionary>
</prism:PrismApplication.Resources>