@Test public void testGetAbsoluteGravity() { assertEquals("Left under LTR", GravityCompat.getAbsoluteGravity(Gravity.LEFT, ViewCompat.LAYOUT_DIRECTION_LTR), Gravity.LEFT); assertEquals("Right under LTR", GravityCompat.getAbsoluteGravity(Gravity.RIGHT, ViewCompat.LAYOUT_DIRECTION_LTR), Gravity.RIGHT); assertEquals("Left under RTL", GravityCompat.getAbsoluteGravity(Gravity.LEFT, ViewCompat.LAYOUT_DIRECTION_RTL), Gravity.LEFT); assertEquals("Right under RTL", GravityCompat.getAbsoluteGravity(Gravity.RIGHT, ViewCompat.LAYOUT_DIRECTION_RTL), Gravity.RIGHT); assertEquals("Start under LTR", GravityCompat.getAbsoluteGravity(GravityCompat.START, ViewCompat.LAYOUT_DIRECTION_LTR), Gravity.LEFT); assertEquals("End under LTR", GravityCompat.getAbsoluteGravity(GravityCompat.END, ViewCompat.LAYOUT_DIRECTION_LTR), Gravity.RIGHT); if (Build.VERSION.SDK_INT >= 17) { assertEquals("Start under RTL", GravityCompat.getAbsoluteGravity(GravityCompat.START, ViewCompat.LAYOUT_DIRECTION_RTL), Gravity.RIGHT); assertEquals("End under RTL", GravityCompat.getAbsoluteGravity(GravityCompat.END, ViewCompat.LAYOUT_DIRECTION_RTL), Gravity.LEFT); } else { assertEquals("Start under RTL", GravityCompat.getAbsoluteGravity(GravityCompat.START, ViewCompat.LAYOUT_DIRECTION_RTL), Gravity.LEFT); assertEquals("End under RTL", GravityCompat.getAbsoluteGravity(GravityCompat.END, ViewCompat.LAYOUT_DIRECTION_RTL), Gravity.RIGHT); } }
public static int getAbsoluteGravity(int gravity, int layoutDirection) { if (SDK_INT >= 17) { return Gravity.getAbsoluteGravity(gravity, layoutDirection); } else { return gravity & ~RELATIVE_LAYOUT_DIRECTION; } }
GravityCompat { public static int getAbsoluteGravity(int gravity, int layoutDirection) { if (SDK_INT >= 17) { return Gravity.getAbsoluteGravity(gravity, layoutDirection); } else { return gravity & ~RELATIVE_LAYOUT_DIRECTION; } } }
GravityCompat { public static int getAbsoluteGravity(int gravity, int layoutDirection) { if (SDK_INT >= 17) { return Gravity.getAbsoluteGravity(gravity, layoutDirection); } else { return gravity & ~RELATIVE_LAYOUT_DIRECTION; } } private  GravityCompat(); }
GravityCompat { public static int getAbsoluteGravity(int gravity, int layoutDirection) { if (SDK_INT >= 17) { return Gravity.getAbsoluteGravity(gravity, layoutDirection); } else { return gravity & ~RELATIVE_LAYOUT_DIRECTION; } } private  GravityCompat(); static void apply(int gravity, int w, int h, Rect container,
            Rect outRect, int layoutDirection); static void apply(int gravity, int w, int h, Rect container,
            int xAdj, int yAdj, Rect outRect, int layoutDirection); static void applyDisplay(int gravity, Rect display, Rect inoutObj, int layoutDirection); static int getAbsoluteGravity(int gravity, int layoutDirection); }
GravityCompat { public static int getAbsoluteGravity(int gravity, int layoutDirection) { if (SDK_INT >= 17) { return Gravity.getAbsoluteGravity(gravity, layoutDirection); } else { return gravity & ~RELATIVE_LAYOUT_DIRECTION; } } private  GravityCompat(); static void apply(int gravity, int w, int h, Rect container,
            Rect outRect, int layoutDirection); static void apply(int gravity, int w, int h, Rect container,
            int xAdj, int yAdj, Rect outRect, int layoutDirection); static void applyDisplay(int gravity, Rect display, Rect inoutObj, int layoutDirection); static int getAbsoluteGravity(int gravity, int layoutDirection); static final int RELATIVE_LAYOUT_DIRECTION; static final int START; static final int END; static final int RELATIVE_HORIZONTAL_GRAVITY_MASK; }