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


Java Gravity.FILL_VERTICAL属性代码示例

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


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

示例1: shouldShowAndroidControls

private boolean shouldShowAndroidControls() {
    if (mBrowserControlsAndroidViewHidden) return false;

    boolean showControls = !drawControlsAsTexture();
    ContentViewCore contentViewCore = getActiveContentViewCore();
    if (contentViewCore == null) return showControls;
    ViewGroup contentView = contentViewCore.getContainerView();

    for (int i = 0; i < contentView.getChildCount(); i++) {
        View child = contentView.getChildAt(i);
        if (!(child.getLayoutParams() instanceof FrameLayout.LayoutParams)) continue;

        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) child.getLayoutParams();
        if (Gravity.TOP == (layoutParams.gravity & Gravity.FILL_VERTICAL)) {
            showControls = true;
            break;
        }
    }

    return showControls;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:ChromeFullscreenManager.java

示例2: setGravity

/**
 * Set the location at which the notification should appear on the screen.
 *
 * @param gravity
 * @param xOffset
 * @param yOffset
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
public IBuilder setGravity(int gravity, int xOffset, int yOffset) {

    // We can resolve the Gravity here by using the Locale for getting
    // the layout direction
    final int finalGravity;
    if (Build.VERSION.SDK_INT >= 14) {
        final Configuration config = mContext.getResources()
                .getConfiguration();
        finalGravity = Gravity.getAbsoluteGravity(gravity, config.getLayoutDirection());
    } else {
        finalGravity = gravity;
    }
    mBuilderParams.gravity = finalGravity;
    if ((finalGravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) {
        mBuilderParams.horizontalWeight = 1.0f;
    }
    if ((finalGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.FILL_VERTICAL) {
        mBuilderParams.verticalWeight = 1.0f;
    }
    mBuilderParams.y = yOffset;
    mBuilderParams.x = xOffset;
    return this;
}
 
开发者ID:gslovemy,项目名称:ToastCompat,代码行数:32,代码来源:CustomToast.java

示例3: applyGravity

/**
 * apply the gravity for window params.
 *
 * @param expectGravity the expect gravity
 * @param applyWlp      the window layout params.
 */
private static void applyGravity(Context context,int expectGravity, WindowManager.LayoutParams applyWlp) {
    if (Build.VERSION.SDK_INT >= 17) {
        final Configuration configuration = context.getResources().getConfiguration();
        final int gravity = Gravity.getAbsoluteGravity(expectGravity, configuration.getLayoutDirection());
        applyWlp.gravity = gravity;
        if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) {
            applyWlp.horizontalWeight = 1.0f;
        }
        if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.FILL_VERTICAL) {
            applyWlp.verticalWeight = 1.0f;
        }
    } else {
        applyWlp.gravity = expectGravity;
    }
}
 
开发者ID:LightSun,项目名称:android-util2,代码行数:21,代码来源:BaseWindow.java

示例4: applyTranslationToTopChildViews

private void applyTranslationToTopChildViews(ViewGroup contentView, float translation) {
    for (int i = 0; i < contentView.getChildCount(); i++) {
        View child = contentView.getChildAt(i);
        if (!(child.getLayoutParams() instanceof FrameLayout.LayoutParams)) continue;

        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) child.getLayoutParams();
        if (Gravity.TOP == (layoutParams.gravity & Gravity.FILL_VERTICAL)) {
            child.setTranslationY(translation);
            TraceEvent.instant("FullscreenManager:child.setTranslationY()");
        }
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:13,代码来源:ChromeFullscreenManager.java


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