Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8915701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:02:01+00:00 2026-06-15T05:02:01+00:00

I have implemented custom view with some children. The view can be scrolled using

  • 0

I have implemented custom view with some children. The view can be scrolled using standard drag gesture. Also every child can be clicked. The problem is, that when I start dragging the view, one of children gets ‘down’ event and it changes its state to ‘pressed’ for a second. I would prefer standard listview behavior – the child goes into pressed state when the user keeps pressing this child with his/her finger for like 50ms. It would reduce blinking caused by misread press event.

I know, that I need at least 2 events to detect if the user is tapping or dragging the view. For now I’m using TimerTask to shedule ‘down’ event. When I get ‘move’ event before my ‘down’ event is executed, I know that the user is dragging and I can cancel the sheduled event.

I know it’s quite hacky. I also tried gesturedetector to detect drag and tap events, but it needs some additional work to properly implement changing view state from pressed to default when the user moves finger and starts to drag the view.

My question is – how this is implemented in android listview? I tried to copy their solution from listview implementation, but it’s so huge I can’t handle it. Simply I don’t see the code responsible for handling such situation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:02:03+00:00Added an answer on June 15, 2026 at 5:02 am

    I managed to understand a gesture detection logic in ListView and, in general, in android views. I wrote my own gesture detector, which is somewhat better than the original one. It reports more gestures (multiple taps, dragging) and has some configurables (timeouts, move epsilon). You can find it open-sourced here: Better Gesture Detector on code.google

    The library uses Handler class and postDelayed()/removeCallbacks() method combination to detect, handle and cancel motion events and gestures. It’s quite simple and one should be able to get the idea by just reading the code.

    This repository also contains a simple demo. Please note that this code is provided ‘as is’, contains some useless comments, logs and should be cleaned up a bit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a custom view within another activity into a XML layout. The
I have created a custom annotation view. In the setSelected method i have implemented
I'm using OSMdroid to implement a mapping application. I have implemented a custom MapTileProvider
Below is a simplification of some code I have for a custom View .
I have implemented a Custom List View which displays text along with image. The
I have implemented my custom Gallery using custom views instead of pictures. Reference was
I have implemented one custom adapter for my list view having checkbox and text
What I have here is a custom view and then I want some widgets
I have implemented a custom ActionMapper which obtains the locale from the URI (the
In my WCF service I have implemented a custom encoder which inherits from System.ServiceModel.Channels.MessageEncoder

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.