How get cell swipe gesture working in android when ListView is in TabbedPage?

5 posts, 1 answers
  1. VincentH
    VincentH avatar
    8 posts
    Member since:
    Sep 2016

    Posted 10 Oct Link to this post

    When I put a ListView in a TabbedPage on Android (using AppCompat), the TabbedPage enables swipe through its tabs left and right. However this overrides the swipe gesture handling of the ListView.

    As a consequence, when the ListView is in the leftmost Tab, you can swipe the cell to the right but a swipe to the left on the swiped cell does a tab swipe to the next tab instead of unswipe the cell.

    When the ListView is in any other tab than the leftmost, a right swipe moves to the previous tab so cell swipe is not accessible at all.

    (How) is it possible to have the ListView swipe gesture take precedence over the TabbedPage swipe gesture? I.e. swiping on the list will do a cell swipe, and swiping outside the list will do a tab swipe.

    Even better would be when swiping to the right on an already right-swiped cell would bubble up to the tab right swipe, and similarly swiping to the left on an unswiped cell would bubble up to the tab left swipe.

    PS: I did find an ugly hack to disable swiping on the TabbedPage which allows the cell swipe to work on Android, but I prefer a solution that does not cripple the TabbedPage (see https://forums.xamarin.com/discussion/comment/205661/#Comment_205661)

  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 12 Oct Link to this post

    Hello,

    It seems that the XamarinForms TabbedPage does not feature changing the pages using swipe by default. Could you double check if the exact and default XamarinFomrs TabbedPage is used in your particular scenario?

    Regards,
    Pavel R. Pavlov
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. VincentH
    VincentH avatar
    8 posts
    Member since:
    Sep 2016

    Posted 12 Oct in reply to Pavel R. Pavlov Link to this post

    I am using a standard TabbedPage; the swipe gesture is added to that automatically when you use android AppCompat to support Material Design as described here: https://developer.xamarin.com/guides/xamarin-forms/platform-features/android/appcompat/

    There is no custom code involved; the swipe is a standard Android feature that gets enabled when using AppCompat, which is recommended best practice for new android apps.

  5. Answer
    Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 17 Oct Link to this post

    Hello,

    It is great that customers are reading and applying the promoted practices. It is true that the swipe navigation between tabs is recommended but it also is mentioned in which cases such navigation should be used. Please take a closer look at the "When to use" section of the material design. There you will find the following:

    "Don't use tabs with content that supports the swipe gesture, because swipe gestures are used for navigating between tabs. "

    This means that if you are willing to follow the material design the design of the application should be changed.

    Regards,
    Pavel R. Pavlov
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. VincentH
    VincentH avatar
    8 posts
    Member since:
    Sep 2016

    Posted 21 Oct in reply to Pavel R. Pavlov Link to this post

    Thanks for you advise, I agree it is a more consistent UX to have the swipe gesture mean only one thing in a Tab. I used the swipe cel to add action buttons to the cell, but an alternative design would be to have the buttons visible in a smaller format at the bottom of each cell - like e.g. in the Android Twitter app. 
Back to Top
DevCraft banner