library/src/main/java/com/lsxiao/library/DraggableLayout.java
/**
     * attachToActivity draggableLayout to view tree and make draggableLayout be a child of the decorView,
     * then let the content view become a child of the draggableLayout.
     * <p/>
     * Draggable dot and the animation will draw on draggable layer which will be drew above on it's children,
     * the DotView is just a placeHolder to listen the down event and notify DraggableLayout to handle the draggable events.
     * so,the DotView can be used in any layout,it's won't have any influence on your own layout.
     *
     * @param activity Activity
     */
attachToActivity draggableLayout to view tree and make draggableLayout be a child of the decorView,
then let the content view become a child of the draggableLayout.

Draggable dot and the animation will draw on draggable layer which will be drew above on it's children,
the DotView is just a placeHolder to listen the down event and notify DraggableLayout to handle the draggable events.
so,the DotView can be used in any layout,it's won't have any influence on your own layout.

@param activity Activity
attachToActivity draggableLayout to view tree and make draggableLayout be a child of the decorView then let the content view become a child of the draggableLayout . Draggable dot and the animation will draw on draggable layer which will be drew above on it ' s children the DotView is just a placeHolder to listen the down event and notify DraggableLayout to handle the draggable events . so the DotView can be used in any layout it ' s won ' t have any influence on your own layout . @param activity Activity
public static void attachToActivity(Activity activity) {
        ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
        /*if is exist,don't attachToActivity again*/
        for (int i = 0; i < decorView.getChildCount(); i++) {
            View view = decorView.getChildAt(i);
            if (view instanceof DraggableLayout) {
                return;
            }
        }
        /*not exist, need to attachToActivity draggableLayout to view tree*/
        DraggableLayout draggableLayout = new DraggableLayout(activity);
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        draggableLayout.setLayoutParams(params);
        for (int i = 0; i < decorView.getChildCount(); i++) {
            View v = decorView.getChildAt(i);
            decorView.removeView(v);
            draggableLayout.addView(v);
        }
        decorView.addView(draggableLayout, 0);
    }
public static void attachToActivity ( Activity activity ) { ViewGroup decorView = ( ViewGroup ) activity . getWindow ( ) . getDecorView ( ) ; /*if is exist,don't attachToActivity again*/ for ( int i = 0 ; i < decorView . getChildCount ( ) ; i ++ ) { View view = decorView . getChildAt ( i ) ; if ( view instanceof DraggableLayout ) { return ; } } /*not exist, need to attachToActivity draggableLayout to view tree*/ DraggableLayout draggableLayout = new DraggableLayout ( activity ) ; FrameLayout . LayoutParams params = new FrameLayout . LayoutParams ( ViewGroup . LayoutParams . MATCH_PARENT , ViewGroup . LayoutParams . MATCH_PARENT ) ; draggableLayout . setLayoutParams ( params ) ; for ( int i = 0 ; i < decorView . getChildCount ( ) ; i ++ ) { View v = decorView . getChildAt ( i ) ; decorView . removeView ( v ) ; draggableLayout . addView ( v ) ; } decorView . addView ( draggableLayout , 0 ) ; }
attachToActivity draggableLayout to view tree and make draggableLayout be a child of the decorView,
 then let the content view become a child of the draggableLayout.
attachToActivity draggableLayout to view tree and make draggableLayout be a child of the decorView then let the content view become a child of the draggableLayout .