本文整理汇总了Java中com.nineoldandroids.view.ViewHelper.setScaleX方法的典型用法代码示例。如果您正苦于以下问题:Java ViewHelper.setScaleX方法的具体用法?Java ViewHelper.setScaleX怎么用?Java ViewHelper.setScaleX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nineoldandroids.view.ViewHelper
的用法示例。
在下文中一共展示了ViewHelper.setScaleX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: animateView
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
private void animateView(float percent) {
float f1 = 1 - percent * 0.3f;
ViewHelper.setScaleX(vg_main, f1); //主布局逐渐变大
ViewHelper.setScaleY(vg_main, f1);
ViewHelper.setTranslationX(vg_left, -vg_left.getWidth() / 2.3f
+ vg_left.getWidth() / 2.3f * percent);
ViewHelper.setScaleX(vg_left, 0.5f + 0.5f * percent);//左边的布局逐渐变小
ViewHelper.setScaleY(vg_left, 0.5f + 0.5f * percent);
ViewHelper.setAlpha(vg_left, percent);
if (isShowShadow) {
ViewHelper.setScaleX(iv_shadow, f1 * 1.4f * (1 - percent * 0.12f));
ViewHelper.setScaleY(iv_shadow, f1 * 1.85f * (1 - percent * 0.12f));
}
getBackground().setColorFilter(
evaluate(percent, Color.BLACK, Color.TRANSPARENT),
Mode.SRC_OVER);
}
示例2: 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();
}
}
}
示例3: animateAccordion
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
private void animateAccordion(View left, View right, float positionOffset) {
if (mState != State.IDLE) {
if (left != null) {
manageLayer(left, true);
ViewHelper.setPivotX(left, left.getMeasuredWidth());
ViewHelper.setPivotY(left, 0);
ViewHelper.setScaleX(left, 1-positionOffset);
}
if (right != null) {
manageLayer(right, true);
ViewHelper.setPivotX(right, 0);
ViewHelper.setPivotY(right, 0);
ViewHelper.setScaleX(right, positionOffset);
}
}
}
示例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: 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);
}
示例6: 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();
}
示例7: onPageSelected
import com.nineoldandroids.view.ViewHelper; //导入方法依赖的package包/类
@Override
public void onPageSelected(int position) {
selectedPosition = position;
//set old view statue
ViewHelper.setAlpha(tabViews.get(oldPosition).get("normal"), 1);
ViewHelper.setAlpha(tabViews.get(oldPosition).get("selected"), 0);
if(oldPosition<tabsContainer.getChildCount()) {
View v_old = tabsContainer.getChildAt(oldPosition);
ViewHelper.setPivotX(v_old, v_old.getMeasuredWidth() * 0.5f);
ViewHelper.setPivotY(v_old, v_old.getMeasuredHeight() * 0.5f);
ViewHelper.setScaleX(v_old, 1f);
ViewHelper.setScaleY(v_old, 1f);
}
//set new view statue
ViewHelper.setAlpha(tabViews.get(position).get("normal"), 0);
ViewHelper.setAlpha(tabViews.get(position).get("selected"), 1);
if(position<tabsContainer.getChildCount()) {
View v_new = tabsContainer.getChildAt(position);
ViewHelper.setPivotX(v_new, v_new.getMeasuredWidth() * 0.5f);
ViewHelper.setPivotY(v_new, v_new.getMeasuredHeight() * 0.5f);
ViewHelper.setScaleX(v_new, 1 + zoomMax);
ViewHelper.setScaleY(v_new, 1 + zoomMax);
}
if (delegatePageListener != null) {
delegatePageListener.onPageSelected(position);
}
oldPosition = selectedPosition;
}
示例8: 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);
}
示例9: 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);
}
示例10: 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;
}
示例11: 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);
}
}
示例12: 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);
}
}
示例13: 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));
}
示例14: 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));
}
}
示例15: 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);
}
});
}
}