Thanks for the help Matt! I implemented a CustomDatePicker and
CustomTimePicker, for both classes have overriden the
onInterceptTouchEvent method and works like a charm now! :)

On 16 dec, 16:47, Matt H <[email protected]> wrote:
> Hi Dirk,
>
> I had the same problem (noticed it yesterday, too, coincidentally!).
> The issue is that the ScrollView is intercepting and stealing the
> touch events once your finger moves outside of the Date/Time Picker
> controls.
>
> To work around this, I created sub classes of Date/TimePicker which
> prevent the parent from stealing events after the initial touch down
> (see below). If you use those in your layout XML instead, you should
> find the problem goes away.
>
> Hope that is useful!
>
> Matt.
>
> import android.content.Context;
> import android.util.AttributeSet;
> import android.view.MotionEvent;
> import android.view.ViewParent;
> import android.widget.DatePicker;
>
> public class CustomDatePicker extends DatePicker
> {
>     public CustomDatePicker(Context context, AttributeSet attrs, int
> defStyle)
>     {
>         super(context, attrs, defStyle);
>     }
>
>     public CustomDatePicker(Context context, AttributeSet attrs)
>     {
>         super(context, attrs);
>     }
>
>     public CustomDatePicker(Context context)
>     {
>         super(context);
>     }
>
>     @Override
>     public boolean onInterceptTouchEvent(MotionEvent ev)
>     {
>         /* Prevent parent controls from stealing our events once we've
> gotten a touch down */
>         if (ev.getActionMasked() == MotionEvent.ACTION_DOWN)
>         {
>             ViewParent p = getParent();
>             if (p != null)
>                 p.requestDisallowInterceptTouchEvent(true);
>         }
>
>         return false;
>     }
>
>
>
>
>
>
>
> }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to