1

I'm trying to implement similar functionality to how Gmail and Outlook apps works, e.g. user can swipe left/right to navigate between emails and inside email you can also horizontally scroll attachments.

This works perfectly in iOS, but doesn't in Android. In iOS when I scroll attachments it does scroll properly and when I want to scroll to another email I can scroll in the area outside "attachmentsList". On Android when I scroll attachments it scrolls emails instead.

My question is - why does it behave differently in iOS vs Android? Is it possible to fix this with some XAML magic workaround? So far tried everything I can think of, can't make it scroll in Android.

Below is a very simplified version of what I'm trying to achieve.

First CollectionView allows to swipe between emails (horizontally):

<CarouselView
    x:Name="emailsList"
    ItemsSource="{Binding Emails}">
    <CarouselView.ItemTemplate>
        <DataTemplate>
            <ctrl:EmailView/>    
        </DataTemplate>
    </CarouselView.ItemTemplate>            
</CarouselView>

Inside EmailView:

<Grid RowDefinitions="40, Auto">
           
   <Label Text="{Binding subject}"/>
            
    <CollectionView 
  x:Name="attachmentsList"
  ItemsSource="{Binding AttachmentNames}"
  HeightRequest="50"
  Grid.Row="1" >
            
  <CollectionView.ItemsLayout>
     <LinearItemsLayout Orientation="Horizontal" ItemSpacing="5"/>
  </CollectionView.ItemsLayout>
            
  <CollectionView.ItemTemplate>
     <DataTemplate>
        <Label Text="{Binding Name}" />
     </DataTemplate>
  </CollectionView.ItemTemplate>
As you can see from below gifs, attachments scrolls on iPhone (left), but on Android it does scroll outer CarouselView instead.

iPhone..............Android

6
  • Why does it behave differently in iOS vs Android? Android does have its own way of handling phone gestures. The APIs for iOS and Android, while doing similar things, have unique differences under the hood. You could try adding a PanGestureRecognizer to your CollectionView. This may help Android decide which scroll to activate. This may not work, but worth a try in the mean time Commented Jun 24 at 12:02
  • Thank you Lewie, you're right. I stumbled upon this github issue raised 3 years ago, looks like Android doesn't handle this. I will try PanGestureRecognizer as per your suggestion, but don't have much hope. Commented Jun 24 at 12:06
  • If that does not work you could look, presuming your a NET 9, you should have access to Syncfusion toolkit. You could replace your CarouselView with an Syncfusion one (Again just a chance its a workout!, it might be able to handle picking the correct swipe). I did think you got access to the ListView, which I'm 99% sure would solve this issue for you (I have signed up for full access via community use [free]) as I prefer most there controls to native MAUI. syncfusion.com/net-maui-toolkit Commented Jun 24 at 12:23
  • I do use Syncfusion, but for this particular case I'm using free "PanCardView". I'm trying to fix this by implementing custom CollectionView handler and preventing parent swipes on Android via RequestDisallowInterceptTouchEvent, hopefully this works. Commented Jun 24 at 12:39
  • Ah okay, hopefully it not a long fix for you Commented Jun 24 at 12:41

1 Answer 1

0

I think if your CarouselView is scrolling horizontally, your collection view must scroll vertically. It works well enough when the parent carousel view scrolls horizontal and the child collection view scrolls vertical

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.