当前位置: 首页>>代码示例>>Java>>正文


Java GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK属性代码示例

本文整理汇总了Java中android.support.v4.view.GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK属性的典型用法代码示例。如果您正苦于以下问题:Java GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK属性的具体用法?Java GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK怎么用?Java GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.support.v4.view.GravityCompat的用法示例。


在下文中一共展示了GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setHorizontalGravity

public void setHorizontalGravity(int horizontalGravity) {
    final int gravity = horizontalGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK;
    if ((mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) != gravity) {
        mGravity = (mGravity & ~GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK) | gravity;
        requestLayout();
    }
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:7,代码来源:AutoLinearLayout.java

示例2: getDrawerWidth

private int getDrawerWidth() {
    for (int i = getChildCount() - 1; i >= 0; --i) {
        View child = getChildAt(i);
        LayoutParams p = (LayoutParams) child.getLayoutParams();
        int hg = p.gravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK;
        if (hg == GravityCompat.START)
            return child.getMeasuredWidth();
    }
    return 0;
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:10,代码来源:LockableDrawerLayout.java

示例3: setGravity

public void setGravity(int gravity) {
    if (this.mGravity != gravity) {
        if ((GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK & gravity) == 0) {
            gravity |= GravityCompat.START;
        }
        if ((gravity & 112) == 0) {
            gravity |= 48;
        }
        this.mGravity = gravity;
        requestLayout();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:12,代码来源:LinearLayoutCompat.java

示例4: setHorizontalGravity

public void setHorizontalGravity(int horizontalGravity) {
    int gravity = horizontalGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK;
    if ((this.mGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK) != gravity) {
        this.mGravity = (this.mGravity & -8388616) | gravity;
        requestLayout();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:7,代码来源:LinearLayoutCompat.java

示例5: setForegroundGravity

public void setForegroundGravity(int foregroundGravity) {
    if (this.mForegroundGravity != foregroundGravity) {
        if ((GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK & foregroundGravity) == 0) {
            foregroundGravity |= GravityCompat.START;
        }
        if ((foregroundGravity & 112) == 0) {
            foregroundGravity |= 48;
        }
        this.mForegroundGravity = foregroundGravity;
        if (this.mForegroundGravity == Opcodes.INVOKE_STATIC_RANGE && this.mForeground != null) {
            this.mForeground.getPadding(new Rect());
        }
        requestLayout();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:ForegroundLinearLayout.java

示例6: layoutVertical

void layoutVertical(int left, int top, int right, int bottom) {
    int childTop;
    int paddingLeft = getPaddingLeft();
    int width = right - left;
    int childRight = width - getPaddingRight();
    int childSpace = (width - paddingLeft) - getPaddingRight();
    int count = getVirtualChildCount();
    int minorGravity = this.mGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK;
    switch (this.mGravity & 112) {
        case 16:
            childTop = getPaddingTop() + (((bottom - top) - this.mTotalLength) / 2);
            break;
        case 80:
            childTop = ((getPaddingTop() + bottom) - top) - this.mTotalLength;
            break;
        default:
            childTop = getPaddingTop();
            break;
    }
    int i = 0;
    while (i < count) {
        View child = getVirtualChildAt(i);
        if (child == null) {
            childTop += measureNullChild(i);
        } else if (child.getVisibility() != 8) {
            int childLeft;
            int childWidth = child.getMeasuredWidth();
            int childHeight = child.getMeasuredHeight();
            LayoutParams lp = (LayoutParams) child.getLayoutParams();
            int gravity = lp.gravity;
            if (gravity < 0) {
                gravity = minorGravity;
            }
            switch (GravityCompat.getAbsoluteGravity(gravity, ViewCompat.getLayoutDirection(this)) & 7) {
                case 1:
                    childLeft = ((((childSpace - childWidth) / 2) + paddingLeft) + lp.leftMargin) - lp.rightMargin;
                    break;
                case 5:
                    childLeft = (childRight - childWidth) - lp.rightMargin;
                    break;
                default:
                    childLeft = paddingLeft + lp.leftMargin;
                    break;
            }
            if (hasDividerBeforeChildAt(i)) {
                childTop += this.mDividerHeight;
            }
            childTop += lp.topMargin;
            setChildFrame(child, childLeft, childTop + getLocationOffset(child), childWidth, childHeight);
            childTop += (lp.bottomMargin + childHeight) + getNextLocationOffset(child);
            i += getChildrenSkipCount(child, i);
        }
        i++;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:55,代码来源:LinearLayoutCompat.java


注:本文中的android.support.v4.view.GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。