Disable keyboard input on Android TimePicker

后端 未结 7 1025
灰色年华
灰色年华 2020-12-08 20:12

I\'m developing and Android app using the 1.6 SDK. I\'m using a TimePicker and I don\'t want the soft keyboard to come up when you click on the digits in the

7条回答
  •  一生所求
    2020-12-08 20:29

    I just tried (targeting 4.0.3)

    myTimePicker.setDescendantFocusability(TimePicker.FOCUS_BLOCK_DESCENDANTS);
    

    with no success. After searching google for "android TimePicker BLOCK_DESCENDANTS not working" i followed the hit

    http://code.google.com/p/android/issues/detail?id=38369
    

    where the last post, which is by a "Project Member", states:

    "Descendant focusability refers to a view's ability to take focus, as in focus traversal using a keyboard, trackball, or d-pad. It does not affect touch events by design.

    If you need to block touch events from a descendant view, consider overriding onInterceptTouchEvent in a parent view and returning true when blocking touch events is desired. This will cause the MotionEvents to be sent to the intercepting parent until the last pointer goes up."

提交回复
热议问题