2016-06-16 12 views
8

私のアプリでは、特にカスタムセルを使用してリストビューでいくつかのアイコンを追加し、レンダリングする色を指定したいと考えています。 Photoshopで各画像を編集する必要はありません。実行時にオーバーレイカラーを適用したいXamarin.Formsを使用して画像にオーバーレイカラーを追加する

カスタムレンダラで可能ですか?

+0

は、なぜあなたは入れないForeground="Red"プロパティの色を指定する 'Grid'または上に何か似ているあなたを'BackgroundColor'と' Opacity'を与えますか? –

+0

何を試しましたか? [How to ask](http://stackoverflow.com/help/how-to-ask)を参照して、[Minimal、Complete、and Verifiable example](http://stackoverflow.com/help/mcve)を作成してください。 – tmthydvnprt

答えて

11

Xamarin.Formsの標準Imageクラスでは不可能です。

しかし、あなたはこの驚くべき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> 

ちょうど

enter image description here

関連する問題