public static void apply(int gravity, int w, int h, Rect container,
                             int xAdj, int yAdj, Rect outRect, int layoutDirection) {
        if (SDK_INT >= 17) {
            Gravity.apply(gravity, w, h, container, xAdj, yAdj, outRect, layoutDirection);
        } else {
            Gravity.apply(gravity, w, h, container, xAdj, yAdj, outRect);
        }
    }
Apply a gravity constant to an object.

@param gravity         The desired placement of the object, as defined by the
                       constants in this class.
@param w               The horizontal size of the object.
@param h               The vertical size of the object.
@param container       The frame of the containing space, in which the object
                       will be placed.  Should be large enough to contain the
                       width and height of the object.
@param xAdj            Offset to apply to the X axis.  If gravity is LEFT this
                       pushes it to the right; if gravity is RIGHT it pushes it to
                       the left; if gravity is CENTER_HORIZONTAL it pushes it to the
                       right or left; otherwise it is ignored.
@param yAdj            Offset to apply to the Y axis.  If gravity is TOP this pushes
                       it down; if gravity is BOTTOM it pushes it up; if gravity is
                       CENTER_VERTICAL it pushes it down or up; otherwise it is
                       ignored.
@param outRect         Receives the computed frame of the object in its
                       container.
@param layoutDirection The layout direction.
@see ViewCompat#LAYOUT_DIRECTION_LTR
@see ViewCompat#LAYOUT_DIRECTION_RTL
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/compat/GravityCompat.java