本文整理汇总了Java中android.support.v4.view.ViewCompat.setScaleX方法的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat.setScaleX方法的具体用法?Java ViewCompat.setScaleX怎么用?Java ViewCompat.setScaleX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.ViewCompat
的用法示例。
在下文中一共展示了ViewCompat.setScaleX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resetPageTransformer
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public static void resetPageTransformer(List<? extends View> views) {
if (views == null) {
return;
}
for (View view : views) {
view.setVisibility(View.VISIBLE);
ViewCompat.setAlpha(view, 1);
ViewCompat.setPivotX(view, view.getMeasuredWidth() * 0.5f);
ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f);
ViewCompat.setTranslationX(view, 0);
ViewCompat.setTranslationY(view, 0);
ViewCompat.setScaleX(view, 1);
ViewCompat.setScaleY(view, 1);
ViewCompat.setRotationX(view, 0);
ViewCompat.setRotationY(view, 0);
ViewCompat.setRotation(view, 0);
}
}
示例2: handleRightPage
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void handleRightPage(View view, float position) {
float scale = Math.max(mMinScale, 1 - position);
float vertMargin = view.getHeight() * (1 - scale) / 2;
float horzMargin = view.getWidth() * (1 - scale) / 2;
ViewCompat.setTranslationX(view, -horzMargin + vertMargin / 2);
ViewCompat.setScaleX(view, scale);
ViewCompat.setScaleY(view, scale);
ViewCompat.setAlpha(view, mMinAlpha + (scale - mMinScale) / (1 - mMinScale) * (1 - mMinAlpha));
}
示例3: setAnimationProgress
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
* Pre API 11, this does an alpha animation.
* @param progress
*/
private void setAnimationProgress(float progress) {
if (isAlphaUsedForScale()) {
setColorViewAlpha((int) (progress * MAX_ALPHA));
} else {
ViewCompat.setScaleX(mCircleView, progress);
ViewCompat.setScaleY(mCircleView, progress);
}
}
示例4: handleRightPage
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void handleRightPage(View view, float position) {
ViewCompat.setAlpha(view, 1 - position);
ViewCompat.setTranslationX(view, -view.getWidth() * position);
float scale = mMinScale + (1 - mMinScale) * (1 - position);
ViewCompat.setScaleX(view, scale);
ViewCompat.setScaleY(view, scale);
}
示例5: scaleOvershootView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
* 从0.5放大...
*/
public static void scaleOvershootView(View view) {
ViewCompat.setScaleX(view, 0.5f);
ViewCompat.setScaleY(view, 0.5f);
view.animate()
.scaleX(1)
.scaleY(1)
.setInterpolator(new OvershootInterpolator(2))
.setDuration(300)
.start();
}
示例6: clearAnimator
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
* clear the animator of the target view.
* @param v the target view
*/
public static void clearAnimator(View v){
ViewCompat.setAlpha(v, 1);
ViewCompat.setScaleY(v, 1);
ViewCompat.setScaleX(v, 1);
ViewCompat.setTranslationY(v, 0);
ViewCompat.setTranslationX(v, 0);
ViewCompat.setRotation(v, 0);
ViewCompat.setRotationY(v, 0);
ViewCompat.setRotationX(v, 0);
ViewCompat.setPivotY(v, v.getMeasuredHeight() / 2);
ViewCompat.setPivotX(v, v.getMeasuredWidth() / 2);
ViewCompat.animate(v).setInterpolator(null).setStartDelay(0);
}
示例7: handleLeftPage
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void handleLeftPage(View view, float position) {
ViewCompat.setAlpha(view, 1);
ViewCompat.setTranslationX(view, 0);
ViewCompat.setScaleX(view, 1);
ViewCompat.setScaleY(view, 1);
}
示例8: setTitleScale
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void setTitleScale(float scale) {
if (type == Type.TABLET) {
return;
}
ViewCompat.setScaleX(titleView, scale);
ViewCompat.setScaleY(titleView, scale);
}
示例9: handleRightPage
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void handleRightPage(View view, float position) {
ViewCompat.setTranslationX(view, -view.getWidth() * position);
ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
ViewCompat.setScaleX(view, 1 - position);
ViewCompat.setScaleY(view, 1 - position);
ViewCompat.setAlpha(view, 1 - position);
}
示例10: onPullReleasing
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onPullReleasing(float fraction, float maxHeadHeight, float headHeight) {
mIsBeingDragged = false;
if (fraction >= 1f) {
ViewCompat.setScaleX(mCircleView, 1f);
ViewCompat.setScaleY(mCircleView, 1f);
} else {
ViewCompat.setScaleX(mCircleView, fraction);
ViewCompat.setScaleY(mCircleView, fraction);
}
}
示例11: moveSpinner
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void moveSpinner(float overscrollTop) {
float slingshotDist;
this.mProgress.showArrow(true);
float dragPercent = Math.min(1.0f, Math.abs(overscrollTop / this.mTotalDragDistance));
float adjustedPercent = (((float) Math.max(((double) dragPercent) - 0.4d, 0.0d)) * 5.0f) / 3.0f;
float extraOS = Math.abs(overscrollTop) - this.mTotalDragDistance;
if (this.mUsingCustomStart) {
slingshotDist = this.mSpinnerFinalOffset - ((float) this.mOriginalOffsetTop);
} else {
slingshotDist = this.mSpinnerFinalOffset;
}
float tensionSlingshotPercent = Math.max(0.0f, Math.min(extraOS, DECELERATE_INTERPOLATION_FACTOR * slingshotDist) / slingshotDist);
float tensionPercent = ((float) (((double) (tensionSlingshotPercent / 4.0f)) - Math.pow((double) (tensionSlingshotPercent / 4.0f), 2.0d))) * DECELERATE_INTERPOLATION_FACTOR;
int targetY = this.mOriginalOffsetTop + ((int) ((slingshotDist * dragPercent) + ((slingshotDist * tensionPercent) * DECELERATE_INTERPOLATION_FACTOR)));
if (this.mCircleView.getVisibility() != 0) {
this.mCircleView.setVisibility(0);
}
if (!this.mScale) {
ViewCompat.setScaleX(this.mCircleView, 1.0f);
ViewCompat.setScaleY(this.mCircleView, 1.0f);
}
if (this.mScale) {
setAnimationProgress(Math.min(1.0f, overscrollTop / this.mTotalDragDistance));
}
if (overscrollTop < this.mTotalDragDistance) {
if (this.mProgress.getAlpha() > STARTING_PROGRESS_ALPHA) {
if (!isAnimationRunning(this.mAlphaStartAnimation)) {
startProgressAlphaStartAnimation();
}
}
} else if (this.mProgress.getAlpha() < 255) {
if (!isAnimationRunning(this.mAlphaMaxAnimation)) {
startProgressAlphaMaxAnimation();
}
}
this.mProgress.setStartEndTrim(0.0f, Math.min(MAX_PROGRESS_ANGLE, adjustedPercent * MAX_PROGRESS_ANGLE));
this.mProgress.setArrowScale(Math.min(1.0f, adjustedPercent));
this.mProgress.setProgressRotation(((-0.25f + (0.4f * adjustedPercent)) + (DECELERATE_INTERPOLATION_FACTOR * tensionPercent)) * DRAG_RATE);
setTargetOffsetTopAndBottom(targetY - this.mCurrentTargetOffsetTop, true);
}
示例12: preAnimateAddImpl
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
protected void preAnimateAddImpl(RecyclerView.ViewHolder holder) {
ViewCompat.setPivotX(holder.itemView, holder.itemView.getWidth());
ViewCompat.setScaleX(holder.itemView, 0);
ViewCompat.setScaleY(holder.itemView, 0);
}
示例13: moveSpinner
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void moveSpinner(float overscrollTop) {
mProgress.showArrow(true);
float originalDragPercent = overscrollTop / mTotalDragDistance;
float dragPercent = Math.min(1f, Math.abs(originalDragPercent));
float adjustedPercent = (float) Math.max(dragPercent - .4, 0) * 5 / 3;
float extraOS = Math.abs(overscrollTop) - mTotalDragDistance;
float slingshotDist = mUsingCustomStart ? mSpinnerOffsetEnd - mOriginalOffsetTop
: mSpinnerOffsetEnd;
float tensionSlingshotPercent = Math.max(0, Math.min(extraOS, slingshotDist * 2)
/ slingshotDist);
float tensionPercent = (float) ((tensionSlingshotPercent / 4) - Math.pow(
(tensionSlingshotPercent / 4), 2)) * 2f;
float extraMove = (slingshotDist) * tensionPercent * 2;
int targetY = mOriginalOffsetTop + (int) ((slingshotDist * dragPercent) + extraMove);
// where 1.0f is a full circle
if (mCircleView.getVisibility() != View.VISIBLE) {
mCircleView.setVisibility(View.VISIBLE);
}
if (!mScale) {
ViewCompat.setScaleX(mCircleView, 1f);
ViewCompat.setScaleY(mCircleView, 1f);
}
if (mScale) {
setAnimationProgress(Math.min(1f, overscrollTop / mTotalDragDistance));
}
if (overscrollTop < mTotalDragDistance) {
if (mProgress.getAlpha() > STARTING_PROGRESS_ALPHA
&& !isAnimationRunning(mAlphaStartAnimation)) {
// Animate the alpha
startProgressAlphaStartAnimation();
}
} else {
if (mProgress.getAlpha() < MAX_ALPHA && !isAnimationRunning(mAlphaMaxAnimation)) {
// Animate the alpha
startProgressAlphaMaxAnimation();
}
}
float strokeStart = adjustedPercent * .8f;
mProgress.setStartEndTrim(0f, Math.min(MAX_PROGRESS_ANGLE, strokeStart));
mProgress.setArrowScale(Math.min(1f, adjustedPercent));
float rotation = (-0.25f + .4f * adjustedPercent + tensionPercent * 2) * .5f;
mProgress.setProgressRotation(rotation);
setTargetOffsetTopAndBottom(targetY - mCurrentTargetOffsetTop, true /* requires update */);
}
示例14: TouchActionMove
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private boolean TouchActionMove(MotionEvent ev) {
final int pointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);
if (pointerIndex < 0) return true;
final float y = MotionEventCompat.getY(ev, pointerIndex);
float overScrollTop;
switch (mType) {
case BOTTOM:
overScrollTop = (mInitialMotionY - y) * 0.5f;
break;
case TOP:
default:
overScrollTop = (y - mInitialMotionY) * 0.5f;
break;
}
if (isReady) {
mProgress.showArrow(true);
float originalDragPercent = overScrollTop / mTotalDragDistance;
if (originalDragPercent < 0) return true;
float dragPercent = Math.min(1f, Math.abs(originalDragPercent));
float adjustedPercent = (float) Math.max(dragPercent - 0.4, 0) * 5 / 3;
float extraOS = Math.abs(overScrollTop) - mTotalDragDistance;
float slingshotDist = mSpinnerFinalOffset;
float tensionSlingshotPercent = Math.max(0, Math.min(extraOS, slingshotDist * 2) / slingshotDist);
float tensionPercent = (float) ((tensionSlingshotPercent / 4) - Math.pow((tensionSlingshotPercent / 4), 2)) * 2f;
float extraMove = (slingshotDist) * tensionPercent * 2;
int targetY;
if (mType == SwipeToRefreshLayoutType.TOP) {
targetY = mOriginalOffsetTop + (int) ((slingshotDist * dragPercent) + extraMove);
} else {
targetY = mOriginalOffsetTop - (int) ((slingshotDist * dragPercent) + extraMove);
}
if (mLoadingView.getVisibility() != View.VISIBLE) {
mLoadingView.setVisibility(View.VISIBLE);
}
ViewCompat.setScaleX(mLoadingView, 1f);
ViewCompat.setScaleY(mLoadingView, 1f);
if (overScrollTop < mTotalDragDistance) {
if (mProgress.getAlpha() > (int) (0.3f * 255) && !isAnimationRunning(mAlphaStartAnimation)) {
startProgressAlphaStartAnimation();
}
float strokeStart = adjustedPercent * 0.8f;
mProgress.setStartEndTrim(0f, Math.min(0.8f, strokeStart));
mProgress.setArrowScale(Math.min(1f, adjustedPercent));
} else {
if (mProgress.getAlpha() < 255 && !isAnimationRunning(mAlphaMaxAnimation)) {
startProgressAlphaMaxAnimation();
}
}
float rotation = (-0.25f + 0.4f * adjustedPercent + tensionPercent * 2) * 0.5f;
mProgress.setProgressRotation(rotation);
setTargetOffsetTopAndBottom(targetY - mCurrentTargetOffsetTop, true);
}
return false;
}
示例15: handleScale
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void handleScale(float scale) {
scale = 0.1f + 0.9f * scale;
ViewCompat.setScaleX(mPullDownView, scale);
ViewCompat.setPivotY(mPullDownView, mPullDownView.getHeight());
ViewCompat.setScaleY(mPullDownView, scale);
}