Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fix Opacity property in Image #5607

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
</FontImageSource>
</Image.Source>
</Image>
<Label
Text="Opacity (0.5)"
Style="{StaticResource Headline}"/>
<Image
Opacity="0.5"
Background="Black"
Source="dotnet_bot.png"
/>
</VerticalStackLayout>
</ScrollView>
</views:BasePage.Content>
Expand Down
1 change: 1 addition & 0 deletions src/Core/src/Handlers/Image/ImageHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static void MapBackground(IImageHandler handler, IImage image)
handler.UpdateValue(nameof(IViewHandler.ContainerView));

handler.ToPlatform().UpdateBackground(image);
handler.ToPlatform().UpdateOpacity(image);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Android the Image the ContainerView setting the Background property because is the way to support correctly gradients. In case we set the ContainerView, update the opacity to apply it also to the container.

}

public static void MapAspect(IImageHandler handler, IImage image) =>
Expand Down