Code example for FrameLayout

Methods: getMeasuredHeight, getMeasuredWidth

0
        // Try to layout the "frame" in the center of the area, and put 
        // "gripper" just to the left of it. If there is no enough space for 
        // the gripper, the "frame" will be moved a little right so that 
        // they won't overlap with each other. 
 
        int frameWidth = mFrame.getMeasuredWidth();
        int frameHeight = mFrame.getMeasuredHeight();
 
        int leftSpace = ((r - l) - frameWidth) / 2;
        int topSpace = ((b - t) - frameHeight) / 2;
 
        int gripperWidth = 0;
        int gripperHeight = 0;
        if (mGripper != null) {
            gripperWidth = mGripper.getMeasuredWidth();
            gripperHeight = mGripper.getMeasuredHeight();
            myLayoutChild(mGripper,
                    Math.max(l, l + (leftSpace - gripperWidth)),
                    t + ((b - t) - gripperHeight) / 2,
                    gripperWidth, gripperHeight);
        }