I'm working on a Xamarin.Forms project (for Android only at the moment). I found a lot of questions where people want to remove the ripple effect: See for example :
- Xamarin.Forms untappable ListView (remove selection ripple effect)
- How to get rid of the listview ripple effect in Xamarin.Forms
But in my case, the ListView Viewcells does not show that effect on selection. I've already verified it has no background color. I want that effect when the user taps a Viewcell. The thing is that it works in another project I made, but I can't figure out why it does not here.
My questions:
- Is this effect native in Android (API 25 on the device)
- For what reason(s) could it not be present when touching the cells ?
My Listview XAML:
<ListView ItemsSource="{Binding PickingParts}"
SeparatorVisibility="None"
SeparatorColor="Transparent"
RowHeight="100"
SelectedItem="{Binding SelectedPickingPart, Mode=TwoWay}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<local:PickingPartItemTemplate />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
And the ItemTemplate:
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MyNamespace;assembly=MyAssembly"
x:Class="MyNamespace.PickingPartItemTemplate">
<StackLayout Spacing="0"
Padding="0"
HorizontalOptions="Fill">
<StackLayout Spacing="5"
Padding="0,0,0,0"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Orientation="Horizontal">
<!-- References -->
<StackLayout HorizontalOptions="StartAndExpand"
VerticalOptions="Center"
Margin="2,0,2,0">
<Label TextColor="{DynamicResource BaseTextColor}">
<Label.FormattedText>
<FormattedString>
<Span Text="{Binding Reference}"
FontAttributes="Bold"
ForegroundColor="{DynamicResource DarkTextColor}" />
<Span Text=" " />
<Span Text="{Binding Description}" />
</FormattedString>
</Label.FormattedText>
</Label>
<Label Text="{Binding Comment}"
FontAttributes="Italic"
FontSize="14"
Opacity=".5"
TextColor="{DynamicResource BaseTextColor}" />
</StackLayout>
<!-- Quantities -->
<StackLayout VerticalOptions="Center"
HorizontalOptions="EndAndExpand"
Margin="2,0,2,0"
WidthRequest="80">
<Label TextColor="{DynamicResource BaseTextColor}"
FontSize="14"
HorizontalTextAlignment="End">
<Label.FormattedText>
<FormattedString>
<Span Text="{Binding Qty}"
FontAttributes="Bold"
ForegroundColor="{DynamicResource DarkTextColor}" />
<Span Text=" " />
<Span Text="{Binding UnitCode}"
FontSize="10" />
</FormattedString>
</Label.FormattedText>
</Label>
<Label TextColor="{Binding StatusColor}"
FontSize="14"
HorizontalTextAlignment="End">
<Label.FormattedText>
<FormattedString>
<Span Text="{x:Static local:FontAwesome.ShoppingCart}"
FontFamily="FontAwesome" />
<Span Text=" " />
<Span Text="{Binding PrepareQty}"
FontAttributes="Bold" />
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>
</StackLayout>
<!-- Bottom Line -->
<BoxView BackgroundColor="{Binding StatusColor}"
HeightRequest="2"
VerticalOptions="End" />
</StackLayout>
</ContentView>