本文整理匯總了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;
}
示例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;
}
示例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;
}
}
示例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()");
}
}
}