當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。