本文整理汇总了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();
}
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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++;
}
}