Reputation: 35
I need to create a button
by placing the image as a separate control because I have a nuget
extension that allows me to change its color. But I would like to create the classic animation of the button
when pressing on it, but I would like the button
not to have a background color, is that possible?
<abstractions:TintedImage
x:Name="profile"
RelativeLayout.YConstraint="{ConstraintExpression
Type=Constant,
Constant=20}"
RelativeLayout.XConstraint="{ConstraintExpression
Type=Constant,
Constant=300}"
WidthRequest="20"
Source="User"
TintColor="{x:DynamicResource TextColor}"/>
<Button
RelativeLayout.YConstraint="{ConstraintExpression
Type=Constant,
Constant=10}"
RelativeLayout.XConstraint="{ConstraintExpression
Type=Constant,
Constant=295}"
HeightRequest="50"
WidthRequest="50"
Clicked="ButtonSettings_Clicked"
BackgroundColor="Transparent"/>
Upvotes: 0
Views: 318
Reputation: 9701
It is called RippleEffect on Android, you can use TouchEffect
from Xamarin.CommunityToolkit package
<Button xct:TouchEffect.NativeAnimation="True"
RelativeLayout.YConstraint="{ConstraintExpression
Type=Constant,
Constant=10}"
RelativeLayout.XConstraint="{ConstraintExpression
Type=Constant,
Constant=295}"
HeightRequest="50"
WidthRequest="50"
Clicked="ButtonSettings_Clicked"
BackgroundColor="Transparent"/>
You can also specify:
NativeAnimationColor
NativeAnimationRadius
NativeAnimationShadowRadius
and a lot more for that effect, a non-exhausted sample could be found in the official repo TouchEffectPage.xaml
Upvotes: 1