TabViewItem swipe not working in Android

2 Answers 345 Views
TabView
Richard
Top achievements
Rank 1
Richard asked on 03 Feb 2023, 01:03 PM

I've tested a couple of scenarios and found that in the following cases, the swipe on the tab view does not work on Android

 

Scenario 1: Controls with gesture recognizers

The first label has a TapGestureRecognizer while the 2nd does not. In my testing, swiping only works on the 2nd label. Note I've tested on several types of gesture recognizers, with and without actual commands. Result stays the same

<telerik:TabViewItem HeaderText="Header">
	<Grid BackgroundColor="AliceBlue" RowDefinitions="*,*,*">
		<Label
			Grid.Row="0"
			BackgroundColor="Orange"
			HorizontalTextAlignment="Center"
			Text="Label With Gesture Recognizer (not working on Android)">
			<Label.GestureRecognizers>
				<TapGestureRecognizer />
			</Label.GestureRecognizers>
		</Label>
		<Label
			Grid.Row="1"
			BackgroundColor="AliceBlue"
			HorizontalTextAlignment="Center"
			Text="Label No Gesture Recognizer (works)" />
	</Grid>
</telerik:TabViewItem>

 

Scenario 2: CollectionView

See below example, but when a CollectionView is swiped over, the swipe does not work
<telerik:TabViewItem HeaderText="Log graph">
	<Grid BackgroundColor="Orange" RowDefinitions="*,*">
		<Grid.Resources>
			<ResourceDictionary>
				<x:Array x:Key="TestData" Type="{x:Type Color}">
					<Color>Aqua</Color>
					<Color>Black</Color>
					<Color>Blue</Color>
					<Color>Fuchsia</Color>
					<Color>Gray</Color>
					<Color>Green</Color>
				</x:Array>
			</ResourceDictionary>
		</Grid.Resources>
		<CollectionView BackgroundColor="Purple" ItemsSource="{StaticResource TestData}">
			<CollectionView.ItemTemplate>
				<DataTemplate>
					<BoxView HeightRequest="50" Color="{Binding}" />
				</DataTemplate>
			</CollectionView.ItemTemplate>
		</CollectionView>
		<Label
				Grid.Row="1"
				BackgroundColor="Red"
				Text="this works" />
	</Grid>
</telerik:TabViewItem>


I'm sure there's more but these two scenarios are prevelant in our app due to custom controls being used as well as collectionviews. 

Tested on iOS without issue.

2 Answers, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 07 Feb 2023, 09:28 AM

Hi Richard,

Thank you for the provided code. We are aware of this behavior on Android. Let me share more details on this: 

The behavior is not related to the TabView control, it is a native limitation on Android when using swipe/scroll/tap gestures. When adding elements that have swipe/scroll/tap, etc. gestures, the swipe content gesture will not work on TabView level, as it propagates to its children, in your case Label with Tap Gesture and a CollectionView which internally has a scrolling.

We are working on providing this information in the documentation.

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Richard
Top achievements
Rank 1
commented on 07 Feb 2023, 10:21 AM

Thank you for the feedback!

I'll read up on this some more, but it's good to know it's a general issues and not specific to telerik.

JP
Top achievements
Rank 2
Iron
commented on 28 Apr 2023, 08:06 AM | edited

Hi Didi, are you going to fix this issue or it is not going to be supported?

TabbedPage works, so I guess is not a limitation on Android.

<TabbedPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:local="clr-namespace:TabbedPageSample;assembly=TabbedPage"
            xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls"
            android:TabbedPage.OffscreenPageLimit="2"
            android:TabbedPage.IsSwipePagingEnabled="true"
            android:TabbedPage.ToolbarPlacement="Bottom"
            x:Class="TabbedPageSample.AppTabbedPage">

Didi
Telerik team
commented on 28 Apr 2023, 10:52 AM

Hi Juan,

RadTabView and TabbedPage have different implementations. RadTabView hosts ContentViews while TabbedPage - Pages. 

I have explained why the behavior occurs in my previous comment. For now we do not have a solution for this native Android behavior. In general it is not related to the TabView control. 

0
JP
Top achievements
Rank 2
Iron
answered on 28 Apr 2023, 08:04 AM
Hi Didi, are you going to fix this issue or it is not going to be supported?
Tags
TabView
Asked by
Richard
Top achievements
Rank 1
Answers by
Didi
Telerik team
JP
Top achievements
Rank 2
Iron
Share this question
or