本文整理汇总了Java中android.view.WindowInsets.replaceSystemWindowInsets方法的典型用法代码示例。如果您正苦于以下问题:Java WindowInsets.replaceSystemWindowInsets方法的具体用法?Java WindowInsets.replaceSystemWindowInsets怎么用?Java WindowInsets.replaceSystemWindowInsets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.WindowInsets
的用法示例。
在下文中一共展示了WindowInsets.replaceSystemWindowInsets方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mInsets[0] = insets.getSystemWindowInsetLeft();
mInsets[1] = insets.getSystemWindowInsetTop();
mInsets[2] = insets.getSystemWindowInsetRight();
mInsets[3] = insets.getSystemWindowInsetBottom();
post(new Runnable() {
@Override
public void run() {
notifyListener();
}
});
return super.onApplyWindowInsets(insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0,
insets.getSystemWindowInsetRight(), lockHeight ? 0 : insets.getSystemWindowInsetBottom()));
} else {
return super.onApplyWindowInsets(insets);
}
}
示例2: applyMarginInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
public static void applyMarginInsets(ViewGroup.MarginLayoutParams paramMarginLayoutParams, Object paramObject, int paramInt)
{
WindowInsets localWindowInsets = (WindowInsets)paramObject;
if (paramInt == 3) {
localWindowInsets = localWindowInsets.replaceSystemWindowInsets(localWindowInsets.getSystemWindowInsetLeft(), localWindowInsets.getSystemWindowInsetTop(), 0, localWindowInsets.getSystemWindowInsetBottom());
}
for (;;)
{
paramMarginLayoutParams.leftMargin = localWindowInsets.getSystemWindowInsetLeft();
paramMarginLayoutParams.topMargin = localWindowInsets.getSystemWindowInsetTop();
paramMarginLayoutParams.rightMargin = localWindowInsets.getSystemWindowInsetRight();
paramMarginLayoutParams.bottomMargin = localWindowInsets.getSystemWindowInsetBottom();
return;
if (paramInt == 5) {
localWindowInsets = localWindowInsets.replaceSystemWindowInsets(0, localWindowInsets.getSystemWindowInsetTop(), localWindowInsets.getSystemWindowInsetRight(), localWindowInsets.getSystemWindowInsetBottom());
}
}
}
示例3: dispatchChildInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private void dispatchChildInsets(View child, Object insets, int drawerGravity) {
WindowInsets wi = (WindowInsets) insets;
if (drawerGravity == Gravity.LEFT) {
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
} else if (drawerGravity == Gravity.RIGHT) {
wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
}
child.dispatchApplyWindowInsets(wi);
}
示例4: applyMarginInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private void applyMarginInsets(MarginLayoutParams lp, Object insets, int drawerGravity, boolean topOnly) {
WindowInsets wi = (WindowInsets) insets;
if (drawerGravity == Gravity.LEFT) {
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
} else if (drawerGravity == Gravity.RIGHT) {
wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
}
lp.leftMargin = wi.getSystemWindowInsetLeft();
lp.topMargin = topOnly ? 0 : wi.getSystemWindowInsetTop();
lp.rightMargin = wi.getSystemWindowInsetRight();
lp.bottomMargin = wi.getSystemWindowInsetBottom();
}
示例5: dispatchChildInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
public static void dispatchChildInsets(View child, Object insets, int gravity) {
WindowInsets wi = (WindowInsets) insets;
if (gravity == Gravity.LEFT) {
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(),
wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
} else if (gravity == Gravity.RIGHT) {
wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(),
wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
}
child.dispatchApplyWindowInsets(wi);
}
示例6: applyMarginInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
public static void applyMarginInsets(ViewGroup.MarginLayoutParams lp, Object insets,
int gravity) {
WindowInsets wi = (WindowInsets) insets;
if (gravity == Gravity.LEFT) {
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(),
wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
} else if (gravity == Gravity.RIGHT) {
wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(),
wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
}
lp.leftMargin = wi.getSystemWindowInsetLeft();
lp.topMargin = wi.getSystemWindowInsetTop();
lp.rightMargin = wi.getSystemWindowInsetRight();
lp.bottomMargin = wi.getSystemWindowInsetBottom();
}
示例7: dispatchChildInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private void dispatchChildInsets(View child, Object insets, int drawerGravity) {
WindowInsets wi = (WindowInsets) insets;
if (drawerGravity == Gravity.LEFT) {
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
} else if (drawerGravity == Gravity.RIGHT) {
wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
}
child.dispatchApplyWindowInsets(wi);
}
示例8: applyMarginInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private void applyMarginInsets(MarginLayoutParams lp, Object insets, int drawerGravity, boolean topOnly) {
WindowInsets wi = (WindowInsets) insets;
if (drawerGravity == Gravity.LEFT) {
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
} else if (drawerGravity == Gravity.RIGHT) {
wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
}
lp.leftMargin = wi.getSystemWindowInsetLeft();
lp.topMargin = topOnly ? 0 : wi.getSystemWindowInsetTop();
lp.rightMargin = wi.getSystemWindowInsetRight();
lp.bottomMargin = wi.getSystemWindowInsetBottom();
}
示例9: dispatchChildInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
public static void dispatchChildInsets(View child, Object insets, int gravity) {
WindowInsets wi = (WindowInsets) insets;
if (gravity == 3) {
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
} else if (gravity == 5) {
wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
}
child.dispatchApplyWindowInsets(wi);
}
示例10: applyMarginInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
public static void applyMarginInsets(MarginLayoutParams lp, Object insets, int gravity) {
WindowInsets wi = (WindowInsets) insets;
if (gravity == 3) {
wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
} else if (gravity == 5) {
wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
}
lp.leftMargin = wi.getSystemWindowInsetLeft();
lp.topMargin = wi.getSystemWindowInsetTop();
lp.rightMargin = wi.getSystemWindowInsetRight();
lp.bottomMargin = wi.getSystemWindowInsetBottom();
}
示例11: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
if (getFitsSystemWindows()) {
mStatusBarInset = insets.getSystemWindowInsetTop();
insets = insets.replaceSystemWindowInsets(
insets.getSystemWindowInsetLeft(),
0, /* top */
insets.getSystemWindowInsetRight(),
insets.getSystemWindowInsetBottom()
);
}
return insets;
}
示例12: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
if (getFitsSystemWindows()) {
mStatusBarInset = insets.getSystemWindowInsetTop();
insets.replaceSystemWindowInsets(
insets.getSystemWindowInsetLeft(),
0, /* top */
insets.getSystemWindowInsetRight(),
insets.getSystemWindowInsetBottom()
);
}
return insets;
}
示例13: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
if (!mHasCalculatedBottomOffset) {
mBottomOffset = getBottomDistance(view);
mHasCalculatedBottomOffset = true;
}
int bottomInset = insets.getSystemWindowInsetBottom();
final int bottomMargin = Math.max(
insets.getSystemWindowInsetBottom() - mBottomOffset, 0);
final ViewGroup.MarginLayoutParams lp =
(ViewGroup.MarginLayoutParams) view.getLayoutParams();
// Check that we have enough space to apply the bottom margins before applying it.
// Otherwise the framework may think that the view is empty and exclude it from layout.
if (bottomMargin < lp.bottomMargin + view.getHeight()) {
lp.setMargins(lp.leftMargin, lp.topMargin, lp.rightMargin, bottomMargin);
view.setLayoutParams(lp);
bottomInset = 0;
}
return insets.replaceSystemWindowInsets(
insets.getSystemWindowInsetLeft(),
insets.getSystemWindowInsetTop(),
insets.getSystemWindowInsetRight(),
bottomInset
);
}
示例14: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mInsets[0] = insets.getSystemWindowInsetLeft();
mInsets[1] = insets.getSystemWindowInsetTop();
mInsets[2] = insets.getSystemWindowInsetRight();
mInsets[3] = insets.getSystemWindowInsetBottom();
if (isViewShow) {
post(new Runnable() {
@Override
public void run() {
notifyListener();
}
});
return super.onApplyWindowInsets(insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0,
insets.getSystemWindowInsetRight(), lockHeight || fixHeight ? 0 : insets.getSystemWindowInsetBottom()));
} else {
setPadding(getPaddingLeft(), 0, getPaddingRight(), 0);
// return super.onApplyWindowInsets(insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0,
// insets.getSystemWindowInsetRight(), lockHeight ? 0 : insets.getSystemWindowInsetBottom()));
return insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0,
insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom());
}
} else {
return super.onApplyWindowInsets(insets);
}
}
示例15: onApplyWindowInsets
import android.view.WindowInsets; //导入方法依赖的package包/类
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
if (getFitsSystemWindows()) {
return super.onApplyWindowInsets(insets);
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return insets.replaceSystemWindowInsets(0, 0, 0, 0);
} else {
return super.onApplyWindowInsets(insets);
}
}
}