setMotionEventSplittingEnabled

    xiaoxiao2021-03-25  149

    Android中ViewGrop

    public void setMotionEventSplittingEnabled (boolean split)

    Enable or disable the splitting of MotionEvents to multiple children during touch event dispatch. This behavior is enabled by default for applications that target an SDK version of HONEYCOMB or newer.

    When this option is enabled MotionEvents may be split and dispatched to different child views depending on where each pointer initially went down. This allows for user interactions such as scrolling two panes of content independently, chording of buttons, and performing independent gestures on different pieces of content. Related XML Attributesandroid:splitMotionEvents

    Parameters split true to allow MotionEvents to be split and dispatched to multiple child views. false to only allow one child view to be the target of any MotionEvent received by this ViewGroup.

    为了只让ViewGrop的点击事件只被目标子视图获取,则设置为false

    background.setMotionEventSplittingEnabled(false);
    转载请注明原文地址: https://ju.6miu.com/read-4477.html

    最新回复(0)