本文整理汇总了Java中com.nineoldandroids.view.ViewHelper.setScaleY方法的典型用法代码示例。如果您正苦于以下问题:Java ViewHelper.setScaleY方法的具体用法?Java ViewHelper.setScaleY怎么用?Java ViewHelper.setScaleY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nineoldandroids.view.ViewHelper
的用法示例。
在下文中一共展示了ViewHelper.setScaleY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: animateStack
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
protected void animateStack(View left, View right, float positionOffset, int positionOffsetPixels) {
if (mState != State.IDLE) {
if (right != null) {
manageLayer(right, true);
mScale = (1-SCALE_MAX) * positionOffset + SCALE_MAX;
mTrans = -getWidth()-getPageMargin()+positionOffsetPixels;
ViewHelper.setScaleX(right, mScale);
ViewHelper.setScaleY(right, mScale);
ViewHelper.setTranslationX(right, mTrans);
}
if (left != null) {
left.bringToFront();
}
}
}
示例2: clear
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
public static void clear(View v) {
ViewHelper.setAlpha(v, 1);
ViewHelper.setScaleY(v, 1);
ViewHelper.setScaleX(v, 1);
ViewHelper.setTranslationY(v, 0);
ViewHelper.setTranslationX(v, 0);
ViewHelper.setRotation(v, 0);
ViewHelper.setRotationY(v, 0);
ViewHelper.setRotationX(v, 0);
// @TODO https://code.google.com/p/android/issues/detail?id=80863
// ViewHelper.setPivotY(v, v.getMeasuredHeight() / 2);
v.setPivotY(v.getMeasuredHeight() / 2);
ViewHelper.setPivotX(v, v.getMeasuredWidth() / 2);
ViewPropertyAnimator.animate(v).setInterpolator(null);
}
示例3: initView
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
private void initView() {
QuickIndexBar quickIndexBar = (QuickIndexBar) findViewById(R.id.quick_index_bar);
listView = (ListView) findViewById(R.id.list_view);
tvCurrentWord = (TextView) findViewById(R.id.tv_current_word);
prepareData(); // 虚拟数据
Collections.sort(friends); // 排序
listView.setAdapter(new FriendAdapter(this, friends));
quickIndexBar.setOnTouchLetterListener(new QuickIndexBar.OnTouchLetterListener() {
@Override
public void onTouchLetter(String letter) {
//根据当前触摸的字母,去集合中找那个 item 的首字母和 letter 一样,然后将对应的item放到屏幕顶端
for (int i = 0; i < friends.size(); i++) {
String firstWord = friends.get(i).getPinYin().charAt(0) + "";
if (letter.equals(firstWord)) {
// 说明找到了,那么应该讲当前的 item 放到屏幕顶端
listView.setSelection(i);
break;
}
}
// 显示当前触摸的字母
showCurrentWord(letter);
}
});
// 通过缩小 tvCurrentWord 来隐藏
ViewHelper.setScaleX(tvCurrentWord, 0f);
ViewHelper.setScaleY(tvCurrentWord, 0f);
}
示例4: reset
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
/**
* reset the view to default status
*
* @param target
*/
public void reset(View target) {
ViewHelper.setAlpha(target, 1);
ViewHelper.setScaleX(target, 1);
ViewHelper.setScaleY(target, 1);
ViewHelper.setTranslationX(target, 0);
ViewHelper.setTranslationY(target, 0);
ViewHelper.setRotation(target, 0);
ViewHelper.setRotationY(target, 0);
ViewHelper.setRotationX(target, 0);
ViewHelper.setPivotX(target, target.getMeasuredWidth() / 2.0f);
ViewHelper.setPivotY(target, target.getMeasuredHeight() / 2.0f);
}
示例5: runEnterAnimation
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
/**
* The enter animation scales the picture in from its previous thumbnail
* size/location, colorizing it in parallel. In parallel, the background of the
* activity is fading in. When the pictue is in place, the text description
* drops down.
*/
private void runEnterAnimation() {
final long duration = ANIM_DURATION;
// Set starting values for properties we're going to animate. These
// values scale and position the full size version down to the thumbnail
// size/location, from which we'll animate it back up
ViewHelper.setPivotX(mViewPager, 0);
ViewHelper.setPivotY(mViewPager, 0);
ViewHelper.setScaleX(mViewPager, (float) thumbnailWidth / mViewPager.getWidth());
ViewHelper.setScaleY(mViewPager, (float) thumbnailHeight / mViewPager.getHeight());
ViewHelper.setTranslationX(mViewPager, thumbnailLeft);
ViewHelper.setTranslationY(mViewPager, thumbnailTop);
// Animate scale and translation to go from thumbnail to full size
ViewPropertyAnimator.animate(mViewPager)
.setDuration(duration)
.scaleX(1)
.scaleY(1)
.translationX(0)
.translationY(0)
.setInterpolator(new DecelerateInterpolator());
// Fade in the black background
ObjectAnimator bgAnim = ObjectAnimator.ofInt(mViewPager.getBackground(), "alpha", 0, 255);
bgAnim.setDuration(duration);
bgAnim.start();
// Animate a color filter to take the image from grayscale to full color.
// This happens in parallel with the image scaling and moving into place.
ObjectAnimator colorizer = ObjectAnimator.ofFloat(ImagePagerFragment.this,
"saturation", 0, 1);
colorizer.setDuration(duration);
colorizer.start();
}
示例6: animViews
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
/**
* 伴随动画
*
* @return 当前滑动的比例
*/
private float animViews() {
float percent = mSlideDx * 1.0f / mSlideRang;
// 左面板: 缩放动画, 平移动画, 透明度动画
// ViewHelper.setScaleX(mLeftView, 0.4f + 0.4f * percent);
// ViewHelper.setScaleY(mLeftView, 0.4f + 0.4f * percent);
ViewHelper.setScaleX(mLeftView, evaluate(percent, 0.4f, 1.0f));
ViewHelper.setScaleY(mLeftView, evaluate(percent, 0.4f, 1.0f));
// 平移动画: -mWidth / 2.0f -> 0.0f
ViewHelper.setTranslationX(mLeftView, evaluate(percent, -mWidth / 2.0f, 0));
// 透明度: 0.4 -> 1.0f
ViewHelper.setAlpha(mLeftView, evaluate(percent, 0.4f, 1.0f));
// 主面板: 缩放动画 1.0f -> 0.8f
ViewHelper.setScaleX(mMainView, evaluate(percent, 1.0f, 0.8f));
ViewHelper.setScaleY(mMainView, evaluate(percent, 1.0f, 0.8f));
// 透明度: 1.0 -> 0.6f
if (mMainAlphaEnable) {
ViewHelper.setAlpha(mMainView, evaluate(percent, 1.0f, 0.6f));
}
// 整个控件的背景动画: 亮度变化 (颜色变化)
if (null != getBackground()) {
getBackground().setColorFilter((Integer) evaluateColor(percent, mAlphaColor, Color.TRANSPARENT), PorterDuff.Mode.SRC_OVER);
}
return percent;
}
示例7: onTransform
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
if (position <= 0f) {
ViewHelper.setTranslationX(view,0f);
ViewHelper.setScaleX(view,1f);
ViewHelper.setScaleY(view,1f);
} else if (position <= 1f) {
final float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
ViewHelper.setAlpha(view,1-position);
ViewHelper.setPivotY(view,0.5f * view.getHeight());
ViewHelper.setTranslationX(view,view.getWidth() * - position);
ViewHelper.setScaleX(view,scaleFactor);
ViewHelper.setScaleY(view,scaleFactor);
}
}
示例8: onTransform
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float scale = 1f + Math.abs(position);
ViewHelper.setScaleX(view,scale);
ViewHelper.setScaleY(view,scale);
ViewHelper.setPivotX(view,view.getWidth() * 0.5f);
ViewHelper.setPivotY(view,view.getWidth() * 0.5f);
ViewHelper.setAlpha(view,position < -1f || position > 1f ? 0f : 1f - (scale - 1f));
if(position < -0.9){
//-0.9 to prevent a small bug
ViewHelper.setTranslationX(view,view.getWidth() * position);
}
}
示例9: onTransform
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
@Override
protected void onTransform(View view, float position) {
final float scale = position < 0 ? position + 1f : Math.abs(1f - position);
ViewHelper.setScaleX(view,scale);
ViewHelper.setScaleY(view,scale);
ViewHelper.setPivotX(view,view.getWidth() * 0.5f);
ViewHelper.setPivotY(view,view.getHeight() * 0.5f);
ViewHelper.setAlpha(view,position < -1f || position > 1f ? 0f : 1f - (scale - 1f));
}
示例10: onTransform
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的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);
ViewHelper.setScaleX(view,scale);
ViewHelper.setScaleY(view,scale);
ViewHelper.setPivotX(view,width * 0.5f);
ViewHelper.setPivotY(view,height * 0.5f);
ViewHelper.setTranslationX(view,position > 0 ? width * position : -width * position * 0.25f);
}
示例11: onTransform
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的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);
ViewHelper.setScaleX(view,scale);
ViewHelper.setScaleY(view,scale);
ViewHelper.setPivotX(view,width*0.5f);
ViewHelper.setPivotY(view,height*0.5f);
ViewHelper.setTranslationX(view,position < 0 ? width * position : -width * position * 0.25f);
}
示例12: onTransform
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的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 scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
final float vertMargin = height * (1 - scaleFactor) / 2;
final float horzMargin = view.getWidth() * (1 - scaleFactor) / 2;
// Center vertically
ViewHelper.setPivotY(view,0.5f * height);
if (position < 0) {
ViewHelper.setTranslationX(view,horzMargin - vertMargin / 2);
} else {
ViewHelper.setTranslationX(view,-horzMargin + vertMargin / 2);
}
// Scale the page down (between MIN_SCALE and 1)
ViewHelper.setScaleX(view,scaleFactor);
ViewHelper.setScaleY(view,scaleFactor);
// Fade the page relative to its size.
ViewHelper.setAlpha(view,MIN_ALPHA + (scaleFactor - MIN_SCALE) / (1 - MIN_SCALE) * (1 - MIN_ALPHA));
}
}
示例13: onBindViewHolder
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(final SubjectsBean positionData, final int position) {
if (positionData != null) {
binding.setSubjectsBean(positionData);
// 图片
// ImgLoadUtil.displayEspImage(positionData.getImages().getLarge(), binding.ivOnePhoto,0);
// 导演
// binding.tvOneDirectors.setText(StringFormatUtil.formatName(positionData.getDirectors()));
// 主演
// binding.tvOneCasts.setText(StringFormatUtil.formatName(positionData.getCasts()));
// 类型
// binding.tvOneGenres.setText("类型:" + StringFormatUtil.formatGenres(positionData.getGenres()));
// 评分
// binding.tvOneRatingRate.setText("评分:" + String.valueOf(positionData.getRating().getAverage()));
// 分割线颜色
binding.viewColor.setBackgroundColor(CommonUtils.randomColor());
ViewHelper.setScaleX(itemView,0.8f);
ViewHelper.setScaleY(itemView,0.8f);
ViewPropertyAnimator.animate(itemView).scaleX(1).setDuration(350).setInterpolator(new OvershootInterpolator()).start();
ViewPropertyAnimator.animate(itemView).scaleY(1).setDuration(350).setInterpolator(new OvershootInterpolator()).start();
binding.llOneItem.setOnClickListener(new PerfectClickListener() {
@Override
protected void onNoDoubleClick(View v) {
OneMovieDetailActivity.start(activity, positionData, binding.ivOnePhoto);
// if (position % 2 == 0) {
// SlideScrollViewActivity.start(activity, positionData, binding.ivOnePhoto);
// MovieDetailActivity.start(activity, positionData, binding.ivOnePhoto);
// OneMovieDetailActivity.start(activity, positionData, binding.ivOnePhoto);
// TestActivity.start(activity, positionData, binding.ivOnePhoto);
// activity.overridePendingTransition(R.anim.push_fade_out, R.anim.push_fade_in);
// } else {
// SlideScrollViewActivity.start(activity, positionData, binding.ivOnePhoto);
// SlideShadeViewActivity.start(activity, positionData, binding.ivOnePhoto);
// OneMovieDetailActivity.start(activity, positionData, binding.ivOnePhoto);
// }
// 这个可以
// SlideScrollViewActivity.start(activity, positionData, binding.ivOnePhoto);
// TestActivity.start(activity,positionData,binding.ivOnePhoto);
// v.getContext().startActivity(new Intent(v.getContext(), SlideScrollViewActivity.class));
// SlideShadeViewActivity.start(activity, positionData, binding.ivOnePhoto);
}
});
}
}
示例14: setSize
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
private void setSize(View view, float position, float percentage) {
ViewHelper.setScaleX(view,(position != 0 && position != 1) ? percentage : 1);
ViewHelper.setScaleY(view,(position != 0 && position != 1) ? percentage : 1);
}
示例15: onScrollChanged
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
draggerView.setSlideEnabled(scrollY <= 0);
// Translate overlay and image
float flexibleRange = mFlexibleSpaceImageHeight - mActionBarSize;
int minOverlayTransitionY = mActionBarSize - mOverlayView.getHeight();
ViewHelper.setTranslationY(mOverlayView, ScrollUtils.getFloat(-scrollY, minOverlayTransitionY, 0));
ViewHelper.setTranslationY(mImageView, ScrollUtils.getFloat(-scrollY, minOverlayTransitionY, 0));
// Change alpha of overlay
// ViewHelper.setAlpha(mOverlayView, ScrollUtils.getFloat((float) scrollY / flexibleRange, 0, 1));
// Scale title text
float scale = 1 + ScrollUtils.getFloat((flexibleRange - scrollY) / flexibleRange, 0, MAX_TEXT_SCALE_DELTA);
ViewHelper.setPivotX(mTitleView, 0);
ViewHelper.setPivotY(mTitleView, 0);
ViewHelper.setScaleX(mTitleView, scale);
ViewHelper.setScaleY(mTitleView, scale);
// Translate title text
int maxTitleTranslationY = (int) (mFlexibleSpaceImageHeight - mTitleView.getHeight() * scale);
int titleTranslationY = maxTitleTranslationY - scrollY;
ViewHelper.setTranslationY(mTitleView, titleTranslationY);
// Translate FAB
int maxFabTranslationY = mFlexibleSpaceImageHeight - 0 / 2;
float fabTranslationY = ScrollUtils.getFloat(
-scrollY + mFlexibleSpaceImageHeight - 0 / 2,
mActionBarSize - 0 / 2,
maxFabTranslationY);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
// On pre-honeycomb, ViewHelper.setTranslationX/Y does not set margin,
// which causes FAB's OnClickListener not working.
// FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mFab.getLayoutParams();
// lp.leftMargin = mOverlayView.getWidth() - mFabMargin - mFab.getWidth();
// lp.topMargin = (int) fabTranslationY;
// mFab.requestLayout();
} else {
// ViewHelper.setTranslationX(mFab, mOverlayView.getWidth() - mFabMargin - mFab.getWidth());
// ViewHelper.setTranslationY(mFab, fabTranslationY);
}
// Show/hide FAB
if (fabTranslationY < mFlexibleSpaceShowFabOffset) {
hideFab();
} else {
showFab();
}
}