Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b954a543 authored by Romain Guy's avatar Romain Guy
Browse files

Fix centering in FrameLayout when margins are specified.

Change-Id: I022f458c73967eacc9487bf8d8119999395efda9
parent 4f43ae09
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -304,8 +304,8 @@ public class FrameLayout extends ViewGroup {
                            childLeft = parentLeft + lp.leftMargin;
                            break;
                        case Gravity.CENTER_HORIZONTAL:
                            childLeft = parentLeft + (parentRight - parentLeft + lp.leftMargin +
                                    lp.rightMargin - width) / 2;
                            childLeft = parentLeft + (parentRight - parentLeft - width) / 2 +
                                    lp.leftMargin - lp.rightMargin;
                            break;
                        case Gravity.RIGHT:
                            childLeft = parentRight - width - lp.rightMargin;
@@ -319,8 +319,8 @@ public class FrameLayout extends ViewGroup {
                            childTop = parentTop + lp.topMargin;
                            break;
                        case Gravity.CENTER_VERTICAL:
                            childTop = parentTop + (parentBottom - parentTop + lp.topMargin +
                                    lp.bottomMargin - height) / 2;
                            childTop = parentTop + (parentBottom - parentTop - height) / 2 +
                                    lp.topMargin - lp.bottomMargin;
                            break;
                        case Gravity.BOTTOM:
                            childTop = parentBottom - height - lp.bottomMargin;