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


Java View.setRotation方法代码示例

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


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

示例1: onPreTransform

import android.view.View; //导入方法依赖的package包/类
/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
 * <p>
 * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do
 * not modify the same page properties. For instance changing from a transformation that applies rotation to a
 * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied
 * alpha.
 * 
 * @param page
 *            Apply the transformation to this page
 * @param position
 *            Position of page relative to the current front-and-center position of the pager. 0 is front and
 *            center. 1 is one full page position to the right, and -1 is one page position to the left.
 */
protected void onPreTransform(View page, float position) {
	final float width = page.getWidth();

	page.setRotationX(0);
	page.setRotationY(0);
	page.setRotation(0);
	page.setScaleX(1);
	page.setScaleY(1);
	page.setPivotX(0);
	page.setPivotY(0);
	page.setTranslationY(0);
	page.setTranslationX(isPagingEnabled() ? 0f : -width * position);

	if (hideOffscreenPages()) {
		page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
		page.setEnabled(false);
	} else {
		page.setEnabled(true);
		page.setAlpha(1f);
	}
}
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:36,代码来源:ABaseTransformer.java

示例2: rotate

import android.view.View; //导入方法依赖的package包/类
@SuppressWarnings("SuspiciousNameCombination")
public void rotate(@NonNull View view, @IntRange(from = 0, to = 359) int rotation) {
    if (!ready()) {
        requestedRotation = rotation;
        requestedModificationView = new WeakReference<>(view);
        return;
    }

    boolean swapWidthHeight = ((rotation / QUARTER_ROTATION) % 2) == 1;
    boolean currentWidthHeightSwapped = ((currentRotation / QUARTER_ROTATION) % 2) == 1;

    //Makes sure the width and height are correctly swapped
    if (swapWidthHeight != currentWidthHeightSwapped) {
        int tempX = intrinsicVideoSize.x;
        intrinsicVideoSize.x = intrinsicVideoSize.y;
        intrinsicVideoSize.y = tempX;

        //We re-apply the scale to make sure it is correct
        scale(view, currentScaleType);
    }

    currentRotation = rotation;
    view.setRotation(rotation);
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:25,代码来源:MatrixManager.java

示例3: onPreTransform

import android.view.View; //导入方法依赖的package包/类
/**
	 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}.
	 * <p>
	 * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do
	 * not modify the same page properties. For instance changing from a transformation that applies rotation to a
	 * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied
	 * alpha.
	 *
	 * @param page
	 *            Apply the transformation to this page
	 * @param position
	 *            Position of page relative to the current front-and-center position of the pager. 0 is front and
	 *            center. 1 is one full page position to the right, and -1 is one page position to the left.
	 */
	protected void onPreTransform(View page, float position) {
		final float width = page.getWidth();

		page.setRotationX(0);
		page.setRotationY(0);
		page.setRotation(0);
		page.setScaleX(1);
		page.setScaleY(1);
		page.setPivotX(0);
		page.setPivotY(0);
		page.setTranslationY(0);
		page.setTranslationX(isPagingEnabled() ? 0f : -width * position);

		if (hideOffscreenPages()) {
			page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
//			page.setEnabled(false);
		} else {
//			page.setEnabled(true);
			page.setAlpha(1f);
		}
	}
 
开发者ID:OCNYang,项目名称:PageTransformerHelp,代码行数:36,代码来源:ABaseTransformer.java

示例4: updateWobbleState

import android.view.View; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void updateWobbleState(int visibleItemCount) {
    for (int i = 0; i < visibleItemCount; i++) {
        View child = getChildAt(i);

        if (child != null) {
            if (mMobileItemId != INVALID_ID && Boolean.TRUE != child.getTag(R.id.wobble_tag)) {
                if (i % 2 == 0)
                    animateWobble(child);
                else
                    animateWobbleInverse(child);
                child.setTag(R.id.wobble_tag, true);
            } else if (mMobileItemId == INVALID_ID && child.getRotation() != 0) {
                child.setRotation(0);
                child.setTag(R.id.wobble_tag, false);
            }
        }

    }
}
 
开发者ID:jpaijh,项目名称:TYT,代码行数:21,代码来源:DynamicGridView.java

示例5: setChildRotationHorizontal

import android.view.View; //导入方法依赖的package包/类
/**
 * Given that the orientation is {@link Orientation#HORIZONTAL}, apply rotation if enabled.
 */
private void setChildRotationHorizontal(@Gravity int gravity, View child, int radius, Point center) {
    if (!rotate) {
        child.setRotation(0);
        return;
    }
    boolean childPastCenter = (child.getX() + child.getWidth() / 2) > center.x;
    float directionMult;
    if (gravity == Gravity.END) {
        directionMult = childPastCenter ? 1 : -1;
    } else {
        directionMult = childPastCenter ? -1 : 1;
    }
    final float opposite = Math.abs(child.getX() + child.getWidth() / 2 - center.x);
    child.setRotation((float) (directionMult * Math.toDegrees(Math.asin(opposite / radius))));
}
 
开发者ID:cdflynn,项目名称:turn-layout-manager,代码行数:19,代码来源:TurnLayoutManager.java

示例6: createShowItemAnimator

import android.view.View; //导入方法依赖的package包/类
private Animator createShowItemAnimator(View item) {

    float dx = fab.getX() - item.getX();
    float dy = fab.getY() - item.getY();

    item.setRotation(0f);
    item.setTranslationX(dx);
    item.setTranslationY(dy);

    Animator anim = ObjectAnimator.ofPropertyValuesHolder(
        item,
        AnimatorUtils.rotation(0f, 720f),
        AnimatorUtils.translationX(dx, 0f),
        AnimatorUtils.translationY(dy, 0f)
    );

    return anim;
  }
 
开发者ID:xzg8023,项目名称:ArcLayout-master,代码行数:19,代码来源:DemoLikePathActivity.java

示例7: setViewLocation

import android.view.View; //导入方法依赖的package包/类
private void setViewLocation(float percentage) {
    final int windowWidth = getWidth();
    final int halfWindowWidth = windowWidth / 2;
    final int radius = (int)Math.round(halfWindowWidth / Math.sin(Math.toRadians(mDegreeUnit)));
    final float HORIZON_SCALE = 1.1f;

    for(int i = 0; i < mReusableViews.size(); i++) {
        View view = mReusableViews.get(i);
        float degree = mDegreeUnit * i - mDegreeUnit * percentage;
        int threshold = mDegreeUnit * (mReusableViews.size() - 1);

        while(Math.abs(degree) >= threshold) {
            if(degree < 0)
                degree += (mReusableViews.size())* mDegreeUnit;
            else
                degree -= (mReusableViews.size()) * mDegreeUnit;
        }

        view.setRotation(degree);
        int left = (int)Math.round(
                halfWindowWidth + HORIZON_SCALE * radius * Math.sin(Math.toRadians(degree)) - mItemViewWidth / 2
        );
        int bottom = (int)Math.round(
                radius * Math.cos(Math.toRadians(degree)) - radius * Math.cos(Math.toRadians(mDegreeUnit))
        );
        view.setTranslationX(left);
        view.setTranslationY(-bottom);

        //Log.d("setting", String.format("(%d) degree: %.4f, position: (%d, %d)", i, degree, left, bottom));
    }
}
 
开发者ID:lycheetw,项目名称:SwipeSectorLayout,代码行数:32,代码来源:SwipeSectorLayout.java

示例8: setItemViewProperty

import android.view.View; //导入方法依赖的package包/类
@Override
protected void setItemViewProperty(View itemView, float targetOffset) {
    itemView.setRotation(targetOffset);
    float scale = calculateScale(itemView,targetOffset);
    itemView.setScaleX(scale);
    itemView.setScaleY(scale);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        itemView.setZ(scale);
    }
}
 
开发者ID:SimonCherryGZ,项目名称:JewelryUI,代码行数:11,代码来源:CircleZoomLayoutManager.java

示例9: onTransform

import android.view.View; //导入方法依赖的package包/类
@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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:RotateDownTransformer.java

示例10: restoreView

import android.view.View; //导入方法依赖的package包/类
private void restoreView(View v) {
    v.setVisibility(endVisibility);
    v.setPivotY(v.getHeight() / 2);
    v.setPivotX(v.getWidth() / 2);
    v.setRotation(0);
    v.setRotationX(0);
    v.setRotationY(0);
    v.setTranslationX(0);
    v.setTranslationY(0);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        v.setTranslationZ(0);
    }
}
 
开发者ID:cmfsotelo,项目名称:FlipLayout,代码行数:14,代码来源:FlipLayout.java

示例11: render

import android.view.View; //导入方法依赖的package包/类
@Override
public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) {

    RectF circleRectangle = layout.calcCircleRectF();

    actionDescription.setX((int) (circleRectangle.right + actionArrow.getWidth()));
    actionDescription.setY(circleRectangle.centerY() - (actionDescription.getHeight() / 2));

    actionArrow.setRotation(180);
    actionArrow.setX(circleRectangle.right);
    actionArrow.setY(circleRectangle.centerY() - (actionArrow.getHeight() / 2));
}
 
开发者ID:Kaufland,项目名称:andcoachmark,代码行数:13,代码来源:RightOfCircleActionDescriptionRenderer.java

示例12: render

import android.view.View; //导入方法依赖的package包/类
@Override
public void render(CoachmarkViewLayout layout, View actionDescription, View actionArrow) {

    RectF circleRectangle = layout.calcCircleRectF();

    actionDescription.setX(circleRectangle.centerX() - (actionDescription.getWidth() / 2));
    actionDescription.setY(circleRectangle.top - actionArrow.getHeight() - actionDescription.getHeight());

    actionArrow.setRotation(90);
    actionArrow.setX(circleRectangle.centerX() - (actionArrow.getWidth() / 2));
    actionArrow.setY(circleRectangle.top - actionArrow.getHeight());
}
 
开发者ID:Kaufland,项目名称:andcoachmark,代码行数:13,代码来源:TopOfCircleActionDescriptionRenderer.java

示例13: move

import android.view.View; //导入方法依赖的package包/类
private static void move(View view, TransformInfo info) {
    computeRenderOffset(view, info.pivotX, info.pivotY);
    adjustTranslation(view, info.deltaX, info.deltaY);

    float scale = view.getScaleX() * info.deltaScale;
    scale = Math.max(info.minimumScale, Math.min(info.maximumScale, scale));
    view.setScaleX(scale);
    view.setScaleY(scale);

    float rotation = adjustAngle(view.getRotation() + info.deltaAngle);
    view.setRotation(rotation);
}
 
开发者ID:eventtus,项目名称:photo-editor-android,代码行数:13,代码来源:MultiTouchListener.java

示例14: rotateView

import android.view.View; //导入方法依赖的package包/类
public static void rotateView(View view,float fromDegree,float toDegree){
    if (Build.VERSION.SDK_INT < 11) {
        RotateAnimation animation = new RotateAnimation(fromDegree, toDegree, Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f);
        animation.setDuration(100);
        animation.setFillAfter(true);
        view.startAnimation(animation);
    } else {
        view.setRotation(toDegree);
    }
}
 
开发者ID:piyell,项目名称:NeteaseCloudMusic,代码行数:11,代码来源:ViewUtil.java

示例15: setRotation

import android.view.View; //导入方法依赖的package包/类
public static void setRotation(View view, float rotation) {
    if (View10.NEED_PROXY) {
        View10.wrap(view).setRotation(rotation);
    } else {
        view.setRotation(rotation);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:8,代码来源:ViewProxy.java


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