gpt4 book ai didi

image - 使用 Xamarin.Forms 向图像添加叠加颜色

转载 作者:行者123 更新时间:2023-12-03 23:35:12 25 4
gpt4 key购买 nike

我想在我的应用程序中添加一些图标,尤其是在使用自定义单元格的 ListView 中,并指定要呈现的颜色。
我不想在 Photoshop 中编辑每个图像;我想在运行时应用叠加颜色。

使用自定义渲染器可以吗?

最佳答案

不,这是不可能通过标准 Image Xamarin.Forms 中提供的类。

但是你可以用这个惊人的IconView这个人创建的自定义渲染器。我一直在使用它,真是太棒了。

IconView for Xamarin Forms

用法

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IconApp.MyPage"
xmlns:controls="clr-namespace:IconApp;assembly=IconApp">
<controls:IconView Source="monkey"
Foreground="Red"
WidthRequest="100"
HeightRequest="100"
HorizontalOptions="Center"
VerticalOptions="Center" />
</ContentPage>

只需指定 Foreground="Red"属性颜色

enter image description here

关于image - 使用 Xamarin.Forms 向图像添加叠加颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37860955/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com