@Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        final int count = getChildCount();
        final int parentLeft = getPaddingLeft();
        final int parentRight = right - left - getPaddingRight();
        final int parentContentWidth = parentRight - parentLeft;
        final int parentTop = getPaddingTop();

        for (int i = 0; i < count; i++) {
            final View child = getChildAt(i);
            if (child.getVisibility() == GONE) {
                continue;
            }

            final int width = child.getMeasuredWidth();
            final int height = child.getMeasuredHeight();

            final int childLeft = parentLeft + (parentContentWidth - width) / 2;
            final int childTop;
            if (mBaseline != -1 && child.getBaseline() != -1) {
                childTop = parentTop + mBaseline - child.getBaseline();
            } else {
                childTop = parentTop;
            }

            child.layout(childLeft, childTop, childLeft + width, childTop + height);
        }
    }
A simple ViewGroup that aligns all the views inside on a baseline. Note: bottom padding for this
view will be measured starting from the baseline.
pager-bottom-tab-strip/src/main/java/me/majiajie/pagerbottomtabstrip/internal/BaselineLayout.java