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


Java Gravity.FILL属性代码示例

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


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

示例1: setForeground

/**
 * Supply a Drawable that is to be rendered on top of all of the child
 * views in the frame layout.  Any padding in the Drawable will be taken
 * into account by ensuring that the children are inset to be placed
 * inside of the padding area.
 *
 * @param drawable The Drawable to be drawn on top of the children.
 */
public void setForeground(View view, Drawable drawable) {
    if (view != null) {
        if (mForeground != drawable) {
            if (mForeground != null) {
                mForeground.setCallback(null);
                view.unscheduleDrawable(mForeground);
            }

            mForeground = drawable;

            if (drawable != null) {
                view.setWillNotDraw(false);
                drawable.setCallback(view);
                if (drawable.isStateful()) {
                    drawable.setState(view.getDrawableState());
                }
                if (mForegroundGravity == Gravity.FILL) {
                    Rect padding = new Rect();
                    drawable.getPadding(padding);
                }

                //update bounds
                updateBounds(view, drawable);//added by song
            } else {
                view.setWillNotDraw(true);
            }
            view.requestLayout();
            view.invalidate();
        }
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:39,代码来源:ForegroundDelegate.java

示例2: setForegroundGravity

public void setForegroundGravity(View view, int foregroundGravity) {
    if (view != null) {
        if (mForegroundGravity != foregroundGravity) {
            if ((foregroundGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) {
                foregroundGravity |= Gravity.START;
            }

            if ((foregroundGravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {
                foregroundGravity |= Gravity.TOP;
            }

            mForegroundGravity = foregroundGravity;

            if (mForegroundGravity == Gravity.FILL && mForeground != null) {
                Rect padding = new Rect();
                mForeground.getPadding(padding);
            }

            view.requestLayout();
        }
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:22,代码来源:ForegroundDelegate.java

示例3: setForegroundGravity

/**
 * Describes how the foreground is positioned. Defaults to START and TOP.
 *
 * @param foregroundGravity See {@link android.view.Gravity}
 *
 * @see #getForegroundGravity()
 */
public void setForegroundGravity(int foregroundGravity) {
    if (mForegroundGravity != foregroundGravity) {
        if ((foregroundGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) {
            foregroundGravity |= Gravity.START;
        }

        if ((foregroundGravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) {
            foregroundGravity |= Gravity.TOP;
        }

        mForegroundGravity = foregroundGravity;


        if (mForegroundGravity == Gravity.FILL && mForeground != null) {
            Rect padding = new Rect();
            mForeground.getPadding(padding);
        }

        requestLayout();
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:28,代码来源:ForegroundLinearLayout.java

示例4: getItemSpacing

private int getItemSpacing(int childCount, int realWidth, int childWidth) {
    final int gravity = getFixedGravity();
    if (gravity == Gravity.FILL) {
        return childCount <= 1 ? 0 : (realWidth - childWidth * childCount) / (childCount - 1);
    } else {
        return minItemSpacing;
    }
}
 
开发者ID:AppliKey,项目名称:ImageMore,代码行数:8,代码来源:ImageMoreView.java

示例5: setForeground

/**
 * Supply a Drawable that is to be rendered on top of all of the child
 * views in the frame layout.  Any padding in the Drawable will be taken
 * into account by ensuring that the children are inset to be placed
 * inside of the padding area.
 *
 * @param drawable The Drawable to be drawn on top of the children.
 */
public void setForeground(Drawable drawable) {
    if (mForeground != drawable) {
        if (mForeground != null) {
            mForeground.setCallback(null);
            unscheduleDrawable(mForeground);
        }

        mForeground = drawable;

        if (drawable != null) {
            setWillNotDraw(false);
            drawable.setCallback(this);
            if (drawable.isStateful()) {
                drawable.setState(getDrawableState());
            }
            if (mForegroundGravity == Gravity.FILL) {
                Rect padding = new Rect();
                drawable.getPadding(padding);
            }
        }  else {
            setWillNotDraw(true);
        }
        requestLayout();
        invalidate();
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:34,代码来源:ForegroundLinearLayout.java

示例6: getFixedGravity

private int getFixedGravity() {
    return isMoreShowed ? Gravity.FILL : gravity;
}
 
开发者ID:AppliKey,项目名称:ImageMore,代码行数:3,代码来源:ImageMoreView.java


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