我有一个演示xamarin表单项目,它只显示一个图像,其图像源设置为远程URL。但问题是它适用于某些URL,而不适用于其他URL。我从谷歌图片搜索中获取了随机图像链接,并编制了一份工作/非工作列表。对这种奇怪行为的任何见解都非常受欢迎。
提前致谢!
工作网址
https://media-cdn.tripadvisor.com/media/photo-s/09/97/8c/27/castle-rock-trading-post.jpg
非工作网址
https://www.seminolehardrockhollywood.com/files/1637/Utilities-EventsCalendar-1250x450.jpg
https://www.chicagotraveler.com/sites/default/files/concerts-chicago-big-1.jpg
XAML文件
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:XamarinImageTest"
x:Class="XamarinImageTest.MainPage"
BackgroundColor="#000000">
<ContentPage.Content>
<Image Source="https://i.ytimg.com/vi/JTxPzXQ1Sso/maxresdefault.jpg"
VerticalOptions="Fill"
HorizontalOptions="Fill"></Image>
</ContentPage.Content>
</ContentPage>
答案 0 :(得分:3)
为您的应用使用原生http客户端处理程序+ TLS2.0(可在项目设置中设置):
对于iOS,还启用http下载:
答案 1 :(得分:1)
我遇到了这个问题。远程图像将以UWP和ISO显示,但不会在Android中显示。有效的方法是更新NuGet Xamarin软件包。