当前位置: 首页>>代码示例>>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;未经允许,请勿转载。