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


Java View.setScaleY方法代码示例

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


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

示例1: transformPage

import android.view.View; //导入方法依赖的package包/类
@SuppressLint("NewApi")
public void transformPage(View page, float position) {
    if (position <= 0.0f) {//被滑动的那页  position 是-下标~ 0
        page.setTranslationX(0f);
        //旋转角度  45° * -0.1 = -4.5°
        page.setRotation((45 * position));
        //X轴偏移 li:  300/3 * -0.1 = -10
        page.setTranslationX((page.getWidth() / 3 * position));
    } else {
        //缩放比例
        float scale = (page.getWidth() - mScaleOffset * position) / (float) (page.getWidth());

        page.setScaleX(scale);
        page.setScaleY(scale);

        page.setTranslationX((-page.getWidth() * position));
        page.setTranslationY((mScaleOffset * 0.8f) * position);
    }
}
 
开发者ID:OCNYang,项目名称:PageTransformerHelp,代码行数:20,代码来源:CascadingPageTransformer.java

示例2: 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:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:ABaseTransformer.java

示例3: scaleSelectedView

import android.view.View; //导入方法依赖的package包/类
private void scaleSelectedView() {
	View localView = getSelectedView();
	if (localView != null) {
		float f1 = this.mScaleXValue - 1.0F;
		float f2 = this.mScaleYValue - 1.0F;
		int i = this.mFrameRate;
		int j = this.mCurrentFrame;
		if (1 == this.mode) {
			i = this.mScaleFrameRate;
			j -= this.mFocusFrameRate;
			if (j <= 0) {
				return;
			}
		}
		float f3 = 1.0F + f1 * j / i;
		float f4 = 1.0F + f2 * j / i;
		localView.setScaleX(f3);
		localView.setScaleY(f4);
	}
}
 
开发者ID:Evan-Galvin,项目名称:FreeStreams-TVLauncher,代码行数:21,代码来源:FocusedBasePositionManager.java

示例4: onTransform

import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
	if (position <= 0f) {
		view.setTranslationX(0f);
		view.setScaleX(1f);
		view.setScaleY(1f);
	} else if (position <= 1f) {
		final float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
		view.setAlpha(1 - position);
		view.setPivotY(0.5f * view.getHeight());
		view.setTranslationX(view.getWidth() * -position);
		view.setScaleX(scaleFactor);
		view.setScaleY(scaleFactor);
	}
}
 
开发者ID:Mrqinlei,项目名称:ImitateZHRB,代码行数:16,代码来源:DepthPageTransformer.java

示例5: onTransform

import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
	final float scale = position < 0 ? position + 1f : Math.abs(1f - position);
	view.setScaleX(scale);
	view.setScaleY(scale);
	view.setPivotX(view.getWidth() * 0.5f);
	view.setPivotY(view.getHeight() * 0.5f);
	view.setAlpha(position < -1f || position > 1f ? 0f : 1f - (scale - 1f));
}
 
开发者ID:Mrqinlei,项目名称:ImitateZHRB,代码行数:10,代码来源:ZoomInTransformer.java

示例6: setScale

import android.view.View; //导入方法依赖的package包/类
/**
 * 缩放
 *
 * @param scaleX
 * @param scaleY
 * @return
 */
public UDView setScale(float scaleX, float scaleY) {
    final View view = getView();
    if (view != null) {
        view.setScaleX(scaleX);
        view.setScaleY(scaleY);
    }
    return this;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:16,代码来源:UDView.java

示例7: onTransform

import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
	if (position >= -1 || position <= 1) {
		// Modify the default slide transition to shrink the page as well
		final float height = view.getHeight();
		final float width = view.getWidth();
		final float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
		final float vertMargin = height * (1 - scaleFactor) / 2;
		final float horzMargin = width * (1 - scaleFactor) / 2;

		// Center vertically
		view.setPivotY(0.5f * height);
		view.setPivotX(0.5f * width);

		if (position < 0) {
			view.setTranslationX(horzMargin - vertMargin / 2);
		} else {
			view.setTranslationX(-horzMargin + vertMargin / 2);
		}

		// Scale the page down (between MIN_SCALE and 1)
		view.setScaleX(scaleFactor);
		view.setScaleY(scaleFactor);

		// Fade the page relative to its size.
		view.setAlpha(MIN_ALPHA + (scaleFactor - MIN_SCALE) / (1 - MIN_SCALE) * (1 - MIN_ALPHA));
	}
}
 
开发者ID:lany192,项目名称:BannerView,代码行数:29,代码来源:ZoomOutSlideTransformer.java

示例8: onTransform

import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
	view.setPivotX(position < 0 ? 0 : view.getWidth());
	view.setPivotY(view.getHeight() / 2f);
	float scale = position < 0 ? 1f + position : 1f - position;
	view.setScaleX(scale);
	view.setScaleY(scale);
}
 
开发者ID:OCNYang,项目名称:PageTransformerHelp,代码行数:9,代码来源:ScaleInOutTransformer.java

示例9: transformPage

import android.view.View; //导入方法依赖的package包/类
@Override
public void transformPage(View page, float position) {
    final float height = page.getHeight();
    final float width = page.getWidth();
    page.setPivotY(0.5f * height);
    page.setPivotX(0.5f * width);
    if (position >= -2 && position <= 2) {
        float mFraction = mDirection * (float) Math.abs(Math.sin(Math.PI * position));
        page.setRotationY(mFraction * mMaxRotateY);
        page.setScaleX(PAGE_SCALE);
        page.setScaleY(PAGE_SCALE);
    }
}
 
开发者ID:codeestX,项目名称:ECardFlow,代码行数:14,代码来源:CardFlowTransformer.java

示例10: transformPage

import android.view.View; //导入方法依赖的package包/类
@SuppressLint("NewApi")
public void transformPage(View view, float position) {
    int pageWidth = view.getWidth();
    int pageHeight = view.getHeight();

    Log.e("TAG", view + " , " + position + "");

    if (position < -1) { // [-Infinity,-1)
        // This page is way off-screen to the left.
        view.setAlpha(0);

    } else if (position <= 1) { //a页滑动至b页 ; a页从 0.0 -1 ;b页从1 ~ 0.0
        // [-1,1]
        // Modify the default slide transition to shrink the page as well
        float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
        float vertMargin = pageHeight * (1 - scaleFactor) / 2;
        float horzMargin = pageWidth * (1 - scaleFactor) / 2;
        if (position < 0) {
            view.setTranslationX(horzMargin - vertMargin / 2);
        } else {
            view.setTranslationX(-horzMargin + vertMargin / 2);
        }

        // Scale the page down (between MIN_SCALE and 1)
        view.setScaleX(scaleFactor);
        view.setScaleY(scaleFactor);

        // Fade the page relative to its size.
        view.setAlpha(MIN_ALPHA + (scaleFactor - MIN_SCALE)
                / (1 - MIN_SCALE) * (1 - MIN_ALPHA));

    } else { // (1,+Infinity]
        // This page is way off-screen to the right.
        view.setAlpha(0);
    }
}
 
开发者ID:ryanlijianchang,项目名称:AdPlayBanner,代码行数:37,代码来源:ZoomOutPageTransformer.java

示例11: 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

示例12: transformPage

import android.view.View; //导入方法依赖的package包/类
public void transformPage(View view, float position) {
    int pageWidth = view.getWidth();
    int pageHeight = view.getHeight();

    if (position < -1) { // [-Infinity,-1)
        // This page is way off-screen to the left.
        view.setAlpha(0);

    } else if (position <= 1) { // [-1,1]
        // Modify the default slide transition to shrink the page as well
        float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
        float vertMargin = pageHeight * (1 - scaleFactor) / 2;
        float horzMargin = pageWidth * (1 - scaleFactor) / 2;
        if (position < 0) {
            view.setTranslationX(horzMargin - vertMargin / 2);
        } else {
            view.setTranslationX(-horzMargin + vertMargin / 2);
        }

        // Scale the page down (between MIN_SCALE and 1)
        view.setScaleX(scaleFactor);
        view.setScaleY(scaleFactor);

        // Fade the page relative to its size.
        view.setAlpha(MIN_ALPHA +
                (scaleFactor - MIN_SCALE) /
                        (1 - MIN_SCALE) * (1 - MIN_ALPHA));

    } else { // (1,+Infinity]
        // This page is way off-screen to the right.
        view.setAlpha(0);
    }
}
 
开发者ID:riteshakya037,项目名称:Flashcards-Demo,代码行数:34,代码来源:ZoomOutPageTransformer.java

示例13: transformPage

import android.view.View; //导入方法依赖的package包/类
public void transformPage(View view, float position) {
            int pageWidth = view.getWidth();

//            view.setBackgroundColor(Color.parseColor("RED"));
            if (position < -1) { // [-Infinity,-1)
                // This page is way off-screen to the left.
                view.setAlpha(0);



            } else if (position <= 0) { // [-1,0]
                // Use the default slide transition when moving to the left page
                view.setAlpha(1);
                //view.setTranslationX(1);
                view.setScaleX(1);
                view.setScaleY(1);
                float yPosition = position * view.getHeight();
                view.setTranslationY(yPosition);
                view.setTranslationX(-1 * view.getWidth() * position);


            } else if (position <= 1) { // (0,1]
                // Fade the page out.
                view.setAlpha(1-position);

                view.setTranslationX(-1 * view.getWidth() * position);

//                 Scale the page down (between MIN_SCALE and 1)
                float scaleFactor = MIN_SCALE
                        + (1 - MIN_SCALE) * (1 - Math.abs(position));
                view.setScaleX(scaleFactor);
                view.setScaleY(scaleFactor);

            } else { // (1,+Infinity]
                // This page is way off-screen to the right.
                view.setAlpha(0);
            }

        }
 
开发者ID:goutham-kalikrishna,项目名称:ShotsNewsApp,代码行数:40,代码来源:VerticalViewPager.java

示例14: onTransform

import android.view.View; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
	final float height = view.getHeight();
	final float width = view.getWidth();
	final float scale = min(position < 0 ? 1f : Math.abs(1f - position), 0.5f);

	view.setScaleX(scale);
	view.setScaleY(scale);
	view.setPivotX(width * 0.5f);
	view.setPivotY(height * 0.5f);
	view.setTranslationX(position < 0 ? width * position : -width * position * 0.25f);
}
 
开发者ID:lany192,项目名称:BannerView,代码行数:13,代码来源:BackgroundToForegroundTransformer.java

示例15: transformPage

import android.view.View; //导入方法依赖的package包/类
@SuppressLint("NewApi")
		public void transformPage(View view, float position)
		{
			int pageWidth = view.getWidth();

			if (position < -1)
			{
				// 页面正在向左离开屏幕 [-Infinity,-1)
				view.setAlpha(0);
			}
			else if (position <= 0)
			{
				// 使用正常的滑动效果,[-1,0]
				view.setAlpha(1);
				view.setScaleX(1);
				view.setScaleY(1);
				
				view.setTranslationX(pageWidth * -position);

			}
			else if (position <= 1)
			{
//				// 渐隐(0,1]
//				view.setAlpha(1 - position);
//
//				// 抵消默认的滑动
//				view.setTranslationX(pageWidth * -position);
//
//				// 按比例缩小图片
//				float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
//				view.setScaleX(scaleFactor);
//				view.setScaleY(scaleFactor);
				
				view.setAlpha(1);
				view.setScaleX(1);
				view.setScaleY(1);
				view.setTranslationX(pageWidth * position);
				
			}
			else
			{
				// 页面向右离开屏幕(1,+Infinity]
				//view.setAlpha(0);
				
				view.setAlpha(1);
				view.setScaleX(1);
				view.setScaleY(1);
				view.setTranslationX(pageWidth * position);
			}
		}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:51,代码来源:ImageRecommendView.java


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