本文整理了Java中android.view.View.setPivotX()
方法的一些代码示例,展示了View.setPivotX()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.setPivotX()
方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:setPivotX
暂无
代码示例来源:origin: commonsguy/cw-omnibus
static void setPivotX(View view, float pivotX) {
view.setPivotX(pivotX);
}
代码示例来源:origin: florent37/ViewAnimator
public AnimationBuilder pivotX(float pivotX) {
for (View view : views) {
view.setPivotX(pivotX);
}
return this;
}
代码示例来源:origin: sd6352051/NiftyDialogEffects
private void reset(View view) {
view.setPivotX(view.getMeasuredWidth() / 2.0f);
view.setPivotY(view.getMeasuredHeight() / 2.0f);
}
代码示例来源:origin: scwang90/SmartRefreshLayout
@Override
protected void preAnimateAddImpl(RecyclerView.ViewHolder holder) {
View icon = holder.itemView.findViewById(R.id.icon);
icon.setRotationX(30);
View right = holder.itemView.findViewById(R.id.right);
right.setPivotX(0);
right.setPivotY(0);
right.setRotationY(90);
}
代码示例来源:origin: florent37/ExpectAnim
public List<Animator> getAnimators() {
final List<Animator> animations = new ArrayList<>();
if(viewToMove != null){
if (pivotX != null) {
viewToMove.setPivotX(pivotX);
}
if (pivotY != null) {
viewToMove.setPivotY(pivotY);
}
}
if (scaleX != null) {
animations.add(ObjectAnimator.ofFloat(viewToMove, View.SCALE_X, scaleX));
}
if (scaleY != null) {
animations.add(ObjectAnimator.ofFloat(viewToMove, View.SCALE_Y, scaleY));
}
return animations;
}
}
代码示例来源:origin: ZieIony/Carbon
@Override
public void setPivotX(float pivotX) {
super.setPivotX(pivotX);
invalidateParentIfNeeded();
fireOnTransformationChangedListener();
}
代码示例来源:origin: xmuSistone/CardSlidePanel
viewItem.setPivotX(viewItem.getMeasuredWidth() / 2);
viewItem.setScaleX(scale);
viewItem.setScaleY(scale);
代码示例来源:origin: xmuSistone/AndroidPileLayout
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int num = getChildCount();
for (int i = 0; i < num; i++) {
View itemView = getChildAt(i);
int left = originX.get(i);
int top = (getMeasuredHeight() - everyHeight) / 2;
int right = left + everyWidth;
int bottom = top + everyHeight;
itemView.layout(left, top, right, bottom);
itemView.setPivotX(0);
itemView.setPivotY(everyHeight / 2);
adjustScale(itemView);
adjustAlpha(itemView);
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void pivotX() {
view.setPivotX(10f);
assertThat(view.getPivotX()).isEqualTo(10f);
}
代码示例来源:origin: Ramotion/garland-view-android
styledAttributes.recycle();
avatar.setPivotX(0);
avatar.setPivotY(0);
texts.setPivotX(0);
代码示例来源:origin: com.nineoldandroids/library
static void setPivotX(View view, float pivotX) {
view.setPivotX(pivotX);
}
代码示例来源:origin: GcsSloop/diycode
public List<Animator> getAnimators() {
final List<Animator> animations = new ArrayList<>();
if(viewToMove != null){
if (pivotX != null) {
viewToMove.setPivotX(pivotX);
}
if (pivotY != null) {
viewToMove.setPivotY(pivotY);
}
}
if (scaleX != null) {
animations.add(ObjectAnimator.ofFloat(viewToMove, View.SCALE_X, scaleX));
}
if (scaleY != null) {
animations.add(ObjectAnimator.ofFloat(viewToMove, View.SCALE_Y, scaleY));
}
return animations;
}
}
代码示例来源:origin: takahirom/PreLollipopTransition
private static void runEnterAnimation(MoveData moveData, TimeInterpolator interpolator, Animator.AnimatorListener listener) {
final View toView = moveData.toView;
toView.setPivotX(0);
toView.setPivotY(0);
toView.setScaleX(moveData.widthScale);
toView.setScaleY(moveData.heightScale);
toView.setTranslationX(moveData.leftDelta);
toView.setTranslationY(moveData.topDelta);
toView.animate()
.setDuration(moveData.duration)
.scaleX(1)
.scaleY(1)
.translationX(0)
.translationY(0)
.setListener(listener)
.setInterpolator(interpolator);
}
代码示例来源:origin: michael-rapp/ChromeLikeTabSwitcher
@Override
public final void setPivot(@NonNull final Axis axis, @NonNull final AbstractItem item,
final float pivot) {
Condition.INSTANCE.ensureNotNull(axis, "The axis may not be null");
Condition.INSTANCE.ensureNotNull(item, "The item may not be null");
View view = item.getView();
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
if (getOrientationInvariantAxis(axis) == Axis.DRAGGING_AXIS) {
float newPivot = pivot - layoutParams.topMargin - tabTitleContainerHeight;
view.setTranslationY(view.getTranslationY() +
(view.getPivotY() - newPivot) * (1 - view.getScaleY()));
view.setPivotY(newPivot);
} else {
float newPivot = pivot - layoutParams.leftMargin;
view.setTranslationX(view.getTranslationX() +
(view.getPivotX() - newPivot) * (1 - view.getScaleX()));
view.setPivotX(newPivot);
}
}
代码示例来源:origin: burhanrashid52/PhotoEditor
private static void computeRenderOffset(View view, float pivotX, float pivotY) {
if (view.getPivotX() == pivotX && view.getPivotY() == pivotY) {
return;
}
float[] prevPoint = {0.0f, 0.0f};
view.getMatrix().mapPoints(prevPoint);
view.setPivotX(pivotX);
view.setPivotY(pivotY);
float[] currPoint = {0.0f, 0.0f};
view.getMatrix().mapPoints(currPoint);
float offsetX = currPoint[0] - prevPoint[0];
float offsetY = currPoint[1] - prevPoint[1];
view.setTranslationX(view.getTranslationX() - offsetX);
view.setTranslationY(view.getTranslationY() - offsetY);
}
代码示例来源:origin: moagrius/TileView
public void setScale(float scale) {
scale = getConstrainedDestinationScale(scale);
if (mScale != scale) {
float previous = mScale;
mScale = scale;
resetScrollPositionToWithinLimits();
if (mShouldVisuallyScaleContents && hasContent()) {
getChild().setPivotX(0);
getChild().setPivotY(0); // TODO: this is a hassle to prefab but would be more efficient
getChild().setScaleX(mScale);
getChild().setScaleY(mScale);
}
if (mScaleChangedListener != null) {
mScaleChangedListener.onScaleChanged(this, mScale, previous);
}
invalidate();
}
}
代码示例来源:origin: weexteam/weex-hackernews
target.setPivotX(pair.first);
target.setPivotY(pair.second);
代码示例来源:origin: Zhaoss/HintPopupWindow
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float value = (float) animation.getAnimatedValue();
view.setPivotX(view.getWidth());
view.setPivotY(0);
view.setScaleX(value);
view.setScaleY(value);
}
});
代码示例来源:origin: gumingwei/WellSwipe
@Override
public void run() {
view.setPivotY(view.getHeight() / 2);
view.setPivotX(view.getWidth() / 2);
view.setVisibility(View.VISIBLE);
animSet.start();
}
});
代码示例来源:origin: maning0303/MNImageBrowser
@Override
protected void onTransform(View view, float position) {
final float width = view.getWidth();
final float height = view.getHeight();
final float rotation = ROT_MOD * position * -1.25f;
view.setPivotX(width * 0.5f);
view.setPivotY(height);
view.setRotation(rotation);
}
内容来源于网络,如有侵权,请联系作者删除!