【发布时间】:2021-01-12 18:34:31
【问题描述】:
我有:api 并想在数组天气中显示图标 -> 图标。
目前我只在 iOS 的显示屏上显示此 API 中的字符串,但看不到图标图像。
我的MainPage.xaml 看起来像这样:
<Frame CornerRadius="10"
OutlineColor="Red"
Margin="10,0,10,0"
BackgroundColor="White"
Opacity="0.5">
<StackLayout VerticalOptions="Center">
<Label x:Name="infoLabel"
Grid.ColumnSpan="3"
TextColor="Black"
HorizontalOptions="Center"
FontAttributes="Bold"
FontSize="15" />
<Label x:Name="infoLabel1"
Grid.ColumnSpan="3"
TextColor="Black"
HorizontalOptions="Center"
FontAttributes="Bold"
FontSize="15" />
</StackLayout>
</Frame>
我的MainPage.xaml.cs 看起来像这样:
string Info = DateDays.DayOfWeek + DateDays.ToString(" MM/dd - HH:mm") + " " + weatherData.weatherForecast[0].Weather.Icon + " " + weatherData.weatherForecast[0].Temperature + "°C";
infoLabel.Text = Info;
string Info1 = DateDays1.DayOfWeek + DateDays1.ToString(" MM/dd - HH:mm") + " " + weatherData.weatherForecast[1].Weather.Icon + " " + weatherData.weatherForecast[1].Temperature + "°C";
infoLabel1.Text = Info1;
结果是:
显示图标的正确方法是什么?
【问题讨论】:
-
最好先阅读描述天气图标工作原理的 API 文档
-
什么意思?
-
文档向您展示如何将“r01n”翻译成图片网址
-
你能给我一些带有文档的网址吗?
标签: c# ios xamarin xamarin.forms