private void layoutHorizontal(int top, int bottom, int left, int right) {
        int leftX = paddingLeft;

        int height = bottom - top;
        int childBottom = height - paddingBottom;
        int availableHeight = height - paddingTop - paddingBottom;

        for (int i = 0; i < getChildCount(); i++) {
            View child = getChildAt(i);
            if (!child.getVisibility().equals(Visibility.GONE)) {
                int topY = 0;
                int childWidth = child.getMeasuredWidth();
                int childHeight = child.getMeasuredHeight();
                LayoutParameters params = (LayoutParameters) child.getLayoutParameters();

                int rawAlignment = params.getAlignment();
                Alignment alignment = Alignment.getHorizontalAlignment(rawAlignment);
                switch (alignment) {
                case TOP:
                    topY = paddingTop + params.getTopMargin();
                    break;
                case CENTER_VERTICAL:
                    topY = paddingTop + ((availableHeight - childHeight) / 2) + params.getTopMargin() - params.getBottomMargin();
                    if (params.centered) {
                        int width = right - left;
                        int availableWidth = width - paddingLeft - paddingRight;
                        leftX = paddingLeft + ((availableWidth - childWidth) / 2);
                    }
                    break;
                case BOTTOM:
                    topY = childBottom - childHeight - params.getBottomMargin();
                    break;
                default:
                    topY = paddingTop;
                }

                leftX += params.getLeftMargin();
                setChildLayout(child, leftX, topY, childWidth, childHeight);
                leftX += childWidth + params.getRightMargin();
            }
        }
    }