當前位置: 首頁>>代碼示例>>Java>>正文


Java View.setScaleX方法代碼示例

本文整理匯總了Java中android.view.View.setScaleX方法的典型用法代碼示例。如果您正苦於以下問題:Java View.setScaleX方法的具體用法?Java View.setScaleX怎麽用?Java View.setScaleX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.View的用法示例。


在下文中一共展示了View.setScaleX方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: transformPage

import android.view.View; //導入方法依賴的package包/類
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.setTranslationX(0);
        view.setScaleX(1);
        view.setScaleY(1);
    } 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);

    } else { // (1,+Infinity]
        view.setAlpha(0);
    }
}
 
開發者ID:shucc,項目名稱:Carousel,代碼行數:23,代碼來源:DepthPageTransformer.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:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:36,代碼來源:ABaseTransformer.java

示例3: setSize

import android.view.View; //導入方法依賴的package包/類
private void setSize(View view, float position, float percentage) {
    if (percentage < 0.85f) {
        percentage = 0.85f;
    }
    view.setScaleX((position != 0 && position != 1) ? percentage : 1);
    view.setScaleY((position != 0 && position != 1) ? percentage : 1);
}
 
開發者ID:homeii,項目名稱:GxIconDIY,代碼行數:8,代碼來源:SimplePageTransformer.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:HanyeeWang,項目名稱:GeekZone,代碼行數:16,代碼來源:DepthPageTransformer.java

示例5: onTransform

import android.view.View; //導入方法依賴的package包/類
@Override
protected void onTransform(View view, float position) {
	final float scale = 1f + Math.abs(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));
	if(position == -1){
		view.setTranslationX(view.getWidth() * -1);
	}
}
 
開發者ID:aomari,項目名稱:AndroidViewPagerRxJava,代碼行數:13,代碼來源:ZoomOutTranformer.java

示例6: 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:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:ForegroundToBackgroundTransformer.java

示例7: scaleViewOnTablet

import android.view.View; //導入方法依賴的package包/類
/**
 * Scales passed view with passed dimension on Tablets only
 */
public static void scaleViewOnTablet(Context context, View view, @DimenRes int dimenRes) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        boolean isTablet = context.getResources().getBoolean(R.bool.isTablet);
        if (isTablet) {
            TypedValue outValue = new TypedValue();
            context.getResources().getValue(dimenRes, outValue, true);
            float scale = outValue.getFloat();
            view.setScaleX(scale);
            view.setScaleY(scale);
        }
    }
}
 
開發者ID:kaliturin,項目名稱:BlackList,代碼行數:16,代碼來源:Utils.java

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

示例9: setAnimation

import android.view.View; //導入方法依賴的package包/類
private void setAnimation(final View view, int position) {
    if (position > mAnimationPosition) {
        view.setScaleX(0f);
        view.setScaleY(0f);
        view.animate()
                .scaleX(1f)
                .scaleY(1f)
                .setDuration(300)
                .setInterpolator(new DecelerateInterpolator());

        mAnimationPosition = position;
    }
}
 
開發者ID:Elbehiry,項目名稱:Viajes,代碼行數:14,代碼來源:AddImageAdapter.java

示例10: transformForegroundPage

import android.view.View; //導入方法依賴的package包/類
@Override
protected void transformForegroundPage(View page, float position,
        boolean enter) {
    page.setTranslationX(0);
    page.setAlpha(1);
    page.setScaleX(1);
    page.setScaleY(1);
}
 
開發者ID:alphater,項目名稱:garras,代碼行數:9,代碼來源:DefaultPageAnimator.java

示例11: setValue

import android.view.View; //導入方法依賴的package包/類
private void setValue(int propertyConstant, float value) {
    View v = (View) this.mView.get();
    if (v != null) {
        switch (propertyConstant) {
            case 1:
                v.setTranslationX(value);
                return;
            case 2:
                v.setTranslationY(value);
                return;
            case 4:
                v.setScaleX(value);
                return;
            case 8:
                v.setScaleY(value);
                return;
            case 16:
                v.setRotation(value);
                return;
            case 32:
                v.setRotationX(value);
                return;
            case 64:
                v.setRotationY(value);
                return;
            case 128:
                v.setX(value);
                return;
            case 256:
                v.setY(value);
                return;
            case 512:
                v.setAlpha(value);
                return;
            default:
                return;
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:40,代碼來源:ViewPropertyAnimatorHC.java

示例12: transformPage

import android.view.View; //導入方法依賴的package包/類
public void transformPage(View view, float position) {
    Log.d("DepthPageTransformer", view.getTag() + " , " + position + "");
    int pageWidth = view.getWidth();

    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(0);
        view.setScaleX(1);
        view.setScaleY(1);

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

        // Counteract the default slide transition
        view.setTranslationX(pageWidth * -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:yiwent,項目名稱:Mobike,代碼行數:34,代碼來源:HelpCardActivity.java

示例13: onTransform

import android.view.View; //導入方法依賴的package包/類
@Override
protected void onTransform(View view, float position) {
	view.setPivotX(position < 0 ? 0 : view.getWidth());
	view.setScaleX(position < 0 ? 1f + position : 1f - position);
}
 
開發者ID:Mrqinlei,項目名稱:ImitateZHRB,代碼行數:6,代碼來源:AccordionTransformer.java

示例14: 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:guangzq,項目名稱:StepDialog,代碼行數:42,代碼來源:ZoomOutPageTransformer.java

示例15: setScaleX

import android.view.View; //導入方法依賴的package包/類
public static void setScaleX(View view, float f) {
    if (view != null && Build.VERSION.SDK_INT >= 11) {
        view.setScaleX(f);
    }
}
 
開發者ID:xieyangxuejun,項目名稱:CommentView,代碼行數:6,代碼來源:ViewUtils.java


注:本文中的android.view.View.setScaleX方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。