lomakk / range-seek-bar

Automatically exported from code.google.com/p/range-seek-bar
0 stars 0 forks source link

Touching the seekbar will scroll up in a scrollable layout #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add the range seeker into a scrollable layout
2. Tap the range seeker (or drag)

What is the expected output? What do you see instead?

The layout should not scroll/change position. However, as soon as I touch the 
range seeker, it scrolls on top. This makes it hard to use.

Am I doing something wrong here or is there a trick to solve this?

Original issue reported on code.google.com by bachi.in...@gmail.com on 19 Jan 2012 at 12:28

GoogleCodeExporter commented 9 years ago
Thanks for the feedback. I too use the widget in a scrollable layout, but don't 
experience this problem. Only if I get too far away from the slider handle when 
dragging, the motion event gets routed to the scrollable container (which in my 
opinion is the correct behaviour).

Could you be more specific about your setting (Android version, UI classes 
being used, etc.)? I'm willing to help, but be aware I'm far from being an 
Android UI expert :)

Original comment by tittel@kom.e-technik.tu-darmstadt.de on 19 Jan 2012 at 4:01

GoogleCodeExporter commented 9 years ago
By now I found out some more details:

- The layout has an EditText field above the widget
- It's the EditText that gets the focus (and thus the ScrollView scrolls there) 
as soon as the slider is moved
- A stock SeekBar view does not invoke that focusing/scrolling when sliding
- If I comment out the overwritten onDraw(Canvas canvas) in RangeSeeker.java, 
the effect is gone (but now drawing of course)
- Even if the code in onDraw() is commented out but merely the empty 
overwritten onDraw() remains, the effect is there

I tried different focus settings but haven't found a solution yet. Any help 
welcome :)

Original comment by bachi.in...@gmail.com on 19 Jan 2012 at 6:09

GoogleCodeExporter commented 9 years ago
Still couldn't reproduce, but this sounds like a focus issue.

Does it help, if you add these 2 lines in the constructor of RangeSeekBar.java:

setFocusable(true);
setFocusableInTouchMode(true);

This should prevent the EditText to gain the focus while interacting with the 
seek bar.

Original comment by tittel@kom.e-technik.tu-darmstadt.de on 20 Jan 2012 at 9:38

GoogleCodeExporter commented 9 years ago
Making the range seeker focusable indeed helped - thanks a lot for the hint 
(pretty obvious actually, but, heck, I searched elsewhere first :) Maybe you 
want to add that to the code too.

Original comment by bachi.in...@gmail.com on 20 Jan 2012 at 2:16

GoogleCodeExporter commented 9 years ago
I updated the code. Thanks for the feedback.

Original comment by tittel@kom.e-technik.tu-darmstadt.de on 20 Jan 2012 at 2:26