當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。