Disable or prevent multitouch in Activity

前端 未结 9 1746
闹比i
闹比i 2020-11-30 03:11

I have several Views on an Activity which a user wants to touch quickly in succession and I capture these touches using a TouchListener and handling Motio

9条回答
  •  执念已碎
    2020-11-30 03:37

    I have solved this using a custom method - which I did not want to do If anyone finds a better way I'd like to hear about it Thanks:

    public static void setViewGroupEnebled(ViewGroup view, boolean enabled)
    {
        int childern = view.getChildCount();
    
        for (int i = 0; i< childern ; i++)
        {
            View child = view.getChildAt(i);
            if (child instanceof ViewGroup)
            {
                setViewGroupEnebled((ViewGroup) child,enabled);
            }
            child.setEnabled(enabled);
        }
        view.setEnabled(enabled);
    }
    

提交回复
热议问题