【问题标题】:Image scaling on Windows Phone with Xamarin Forms使用 Xamarin Forms 在 Windows Phone 上缩放图像
【发布时间】:2016-07-23 03:30:44
【问题描述】:

我正在处理一个 Xamarin.Forms 项目,但在使用 Windows Phone 缩放图像时遇到了问题。 Windows and Android

我正在使用网格来显示所有图标,这是我用于 1 个图像按钮的代码。

<Button Image="cam.png"
        VerticalOptions="Center"
        Grid.Row="0" Grid.Column="0"
        BorderColor="Transparent"
        BackgroundColor="Transparent"
        Clicked="OnTrafficClicked"/>

我发现了几个类似的帖子,但我不明白当有多个图像时如何在平台上实现缩放。

我试过了,但无法运行程序

<Image.Scale>
  <OnPlatform x:TypeArguments="Scale"
              WinPhone="1.5" />
</Image.Scale>

https://forums.xamarin.com/discussion/19525/image-source-with-onplatform-in-xaml

【问题讨论】:

标签: windows-phone cross-platform xamarin.forms


【解决方案1】:

我能弄明白,万一有人遇到同样的问题,我就是这样做的:

<ContentPage.Resources>
    <ResourceDictionary>
      <OnPlatform x:Key="stdScaling" x:TypeArguments="x:Double"
      iOS="1.0"
      Android="1.0"
      WinPhone="2.5" />
    </ResourceDictionary>
</ContentPage.Resources>

然后对于按钮,我放了

Scale= "{StaticResource stdScaling}"

【讨论】:

    猜你喜欢
    • 2019-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-13
    相关资源
    最近更新 更多