本文整理了Java中android.view.View.offsetLeftAndRight()
方法的一些代码示例,展示了View.offsetLeftAndRight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.offsetLeftAndRight()
方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:offsetLeftAndRight
暂无
代码示例来源:origin: chentao0707/SimplifyReader
protected void onOffsetChild(View child, int position, int offsetLeft, int offsetTop) {
child.offsetLeftAndRight(offsetLeft);
child.offsetTopAndBottom(offsetTop);
}
代码示例来源:origin: rey5137/material
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float factor = interpolator.getInterpolation(valueAnimator.getAnimatedFraction());
float left = prevLeft + (nextLeft - prevLeft) * factor;
view.offsetLeftAndRight((int) (left - view.getLeft()));
if (valueAnimator.getAnimatedFraction() == 1f) {
if (doOnEndRunnable != null)
doOnEndRunnable.run();
}
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
@Override
public void moveViewInOverlay(@NonNull ViewGroup sceneRoot, @NonNull View overlayView, int screenX, int screenY) {
if (screenX != 0 || screenY != 0) {
int[] loc = new int[2];
sceneRoot.getLocationOnScreen(loc);
overlayView.offsetLeftAndRight((screenX - loc[0]) - overlayView.getLeft());
overlayView.offsetTopAndBottom((screenY - loc[1]) - overlayView.getTop());
}
}
代码示例来源:origin: githubwing/ZoomHeader
bottom.offsetLeftAndRight(
(int) (target.getWidth() / 2 - target.getWidth() * (1 + progress) / 2
+ MarginConfig.MARGIN_LEFT_RIGHT - bottom.getX()));
buyButton.offsetLeftAndRight(
(int) (target.getWidth() / 2 + target.getWidth() * (1 + progress) / 2
- buyButton.getWidth()
代码示例来源:origin: umano/AndroidSlidingUpPanel
private void dragTo(int left, int top, int dx, int dy) {
int clampedX = left;
int clampedY = top;
final int oldLeft = mCapturedView.getLeft();
final int oldTop = mCapturedView.getTop();
if (dx != 0) {
clampedX = mCallback.clampViewPositionHorizontal(mCapturedView, left, dx);
mCapturedView.offsetLeftAndRight(clampedX - oldLeft);
}
if (dy != 0) {
clampedY = mCallback.clampViewPositionVertical(mCapturedView, top, dy);
mCapturedView.offsetTopAndBottom(clampedY - oldTop);
}
if (dx != 0 || dy != 0) {
final int clampedDx = clampedX - oldLeft;
final int clampedDy = clampedY - oldTop;
mCallback.onViewPositionChanged(mCapturedView, clampedX, clampedY,
clampedDx, clampedDy);
}
}
代码示例来源:origin: naman14/Timber
private void dragTo(int left, int top, int dx, int dy) {
int clampedX = left;
int clampedY = top;
final int oldLeft = mCapturedView.getLeft();
final int oldTop = mCapturedView.getTop();
if (dx != 0) {
clampedX = mCallback.clampViewPositionHorizontal(mCapturedView, left, dx);
mCapturedView.offsetLeftAndRight(clampedX - oldLeft);
}
if (dy != 0) {
clampedY = mCallback.clampViewPositionVertical(mCapturedView, top, dy);
mCapturedView.offsetTopAndBottom(clampedY - oldTop);
}
if (dx != 0 || dy != 0) {
final int clampedDx = clampedX - oldLeft;
final int clampedDy = clampedY - oldTop;
mCallback.onViewPositionChanged(mCapturedView, clampedX, clampedY,
clampedDx, clampedDy);
}
}
代码示例来源:origin: chentao0707/SimplifyReader
private void dragTo(int left, int top, int dx, int dy) {
int clampedX = left;
int clampedY = top;
final int oldLeft = mCapturedView.getLeft();
final int oldTop = mCapturedView.getTop();
if (dx != 0) {
clampedX = mCallback.clampViewPositionHorizontal(mCapturedView, left, dx);
mCapturedView.offsetLeftAndRight(clampedX - oldLeft);
}
if (dy != 0) {
clampedY = mCallback.clampViewPositionVertical(mCapturedView, top, dy);
mCapturedView.offsetTopAndBottom(clampedY - oldTop);
}
if (dx != 0 || dy != 0) {
final int clampedDx = clampedX - oldLeft;
final int clampedDy = clampedY - oldTop;
mCallback
.onViewPositionChanged(mCapturedView, clampedX, clampedY, clampedDx, clampedDy);
}
}
代码示例来源:origin: wangdan/AisenWeiBo
private void dragTo(int left, int top, int dx, int dy) {
int clampedX = left;
int clampedY = top;
final int oldLeft = mCapturedView.getLeft();
final int oldTop = mCapturedView.getTop();
if (dx != 0) {
clampedX = mCallback.clampViewPositionHorizontal(mCapturedView, left, dx);
mCapturedView.offsetLeftAndRight(clampedX - oldLeft);
}
if (dy != 0) {
clampedY = mCallback.clampViewPositionVertical(mCapturedView, top, dy);
mCapturedView.offsetTopAndBottom(clampedY - oldTop);
}
if (dx != 0 || dy != 0) {
final int clampedDx = clampedX - oldLeft;
final int clampedDy = clampedY - oldTop;
mCallback
.onViewPositionChanged(mCapturedView, clampedX, clampedY, clampedDx, clampedDy);
}
}
代码示例来源:origin: joyoyao/superCleanMaster
private void dragTo(int left, int top, int dx, int dy) {
int clampedX = left;
int clampedY = top;
final int oldLeft = mCapturedView.getLeft();
final int oldTop = mCapturedView.getTop();
if (dx != 0) {
clampedX = mCallback.clampViewPositionHorizontal(mCapturedView, left, dx);
mCapturedView.offsetLeftAndRight(clampedX - oldLeft);
}
if (dy != 0) {
clampedY = mCallback.clampViewPositionVertical(mCapturedView, top, dy);
mCapturedView.offsetTopAndBottom(clampedY - oldTop);
}
if (dx != 0 || dy != 0) {
final int clampedDx = clampedX - oldLeft;
final int clampedDy = clampedY - oldTop;
mCallback
.onViewPositionChanged(mCapturedView, clampedX, clampedY, clampedDx, clampedDy);
}
}
代码示例来源:origin: bingoogolapple/BGASwipeBackLayout-Android
private void parallaxOtherViews(float slideOffset) {
final boolean isLayoutRtl = isLayoutRtlSupport();
final LayoutParams slideLp = (LayoutParams) mSlideableView.getLayoutParams();
final boolean dimViews = slideLp.dimWhenOffset
&& (isLayoutRtl ? slideLp.rightMargin : slideLp.leftMargin) <= 0;
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
final View v = getChildAt(i);
if (v == mSlideableView) continue;
final int oldOffset = (int) ((1 - mParallaxOffset) * mParallaxBy);
mParallaxOffset = slideOffset;
final int newOffset = (int) ((1 - slideOffset) * mParallaxBy);
final int dx = oldOffset - newOffset;
v.offsetLeftAndRight(isLayoutRtl ? -dx : dx);
if (dimViews) {
dimChildView(v, isLayoutRtl ? mParallaxOffset - 1
: 1 - mParallaxOffset, mCoveredFadeColor);
}
}
}
代码示例来源:origin: Ramotion/cardslider-android
final int border = activeCardLeft + getPosition(view) * cardWidth;
final int allowedDelta = getAllowedRightDelta(view, dx, border);
view.offsetLeftAndRight(-allowedDelta);
final int border = activeCardLeft + getPosition(view) * cardWidth;
final int allowedDelta = getAllowedRightDelta(view, dx, border);
view.offsetLeftAndRight(-allowedDelta);
} else {
final int border = activeCardLeft - step * j;
view.offsetLeftAndRight(-getAllowedRightDelta(view, jDelta, border));
j++;
代码示例来源:origin: daimajia/AndroidSwipeLayout
currentBottomView.offsetLeftAndRight(dx);
} else {
currentBottomView.offsetTopAndBottom(dy);
surfaceView.offsetLeftAndRight(dx);
surfaceView.offsetTopAndBottom(dy);
} else {
代码示例来源:origin: hackware1993/MagicIndicator
int offset = mXBadgeRule.getOffset();
int newLeft = x + offset;
mBadgeView.offsetLeftAndRight(newLeft - mBadgeView.getLeft());
代码示例来源:origin: aa112901/remusic
child.offsetLeftAndRight(childOffset);
代码示例来源:origin: Ramotion/cardslider-android
view.offsetLeftAndRight(getAllowedLeftDelta(view, delta, activeCardLeft));
} else {
int border = activeCardLeft - step;
for (int j = i; j >= 0; j--) {
final View jView = getChildAt(j);
jView.offsetLeftAndRight(getAllowedLeftDelta(jView, jDelta, border));
border -= step;
代码示例来源:origin: naman14/Timber
mCapturedView.offsetLeftAndRight(dx);
代码示例来源:origin: umano/AndroidSlidingUpPanel
mCapturedView.offsetLeftAndRight(dx);
代码示例来源:origin: chentao0707/SimplifyReader
mCapturedView.offsetLeftAndRight(dx);
代码示例来源:origin: joyoyao/superCleanMaster
mCapturedView.offsetLeftAndRight(dx);
代码示例来源:origin: wangdan/AisenWeiBo
mCapturedView.offsetLeftAndRight(dx);
内容来源于网络,如有侵权,请联系作者删除!