¿Cómo se puede utilizar ViewPropertyAnimator para establecer Width a un valor específico

¿Cómo puedo usar ViewPropertyAnimator para establecer el ancho de mi vista?

Puedo escalar o traducir (ver abajo) pero no puedo fijar a una anchura específica.

frame_1.animate().scaleX(5).scaleY(5).start(); 

pero no hay

 frame_1.animate().width(1024).height(768).start(); 

Utilice animación simple en lugar de ViewPropertyAnimator

 public class ResizeWidthAnimation extends Animation { private int mWidth; private int mStartWidth; private View mView; public ResizeWidthAnimation(View view, int width) { mView = view; mWidth = width; mStartWidth = view.getWidth(); } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { int newWidth = mStartWidth + (int) ((mWidth - mStartWidth) * interpolatedTime); mView.getLayoutParams().width = newWidth; mView.requestLayout(); } @Override public void initialize(int width, int height, int parentWidth, int parentHeight) { super.initialize(width, height, parentWidth, parentHeight); } @Override public boolean willChangeBounds() { return true; } 

}

Pruebe esto, soporte incluso desde Android 2.3:

  ValueAnimatorCompat exitAnimator = AnimatorCompatHelper.emptyValueAnimator(); exitAnimator.setDuration(TransitCompat.ANIM_DURATION * 4); exitAnimator.addUpdateListener(new AnimatorUpdateListenerCompat() { private float oldWidth = view.getWidth(); private float endWidth = 0; private float oldHeight = view.getHeight(); private float endHeight = 0; private Interpolator interpolator2 = new BakedBezierInterpolator();//Any other will be also OK @Override public void onAnimationUpdate(ValueAnimatorCompat animation) { float fraction = interpolator2.getInterpolation(animation.getAnimatedFraction()); float width = oldWidth + (fraction * (endWidth - oldWidth)); mTarget.get().getLayoutParams().width = (int) width; float height = oldHeight + (fraction * (endHeight - oldHeight)); view.getLayoutParams().height = (int) height; view.requestLayout(); } }); exitAnimator.start(); 
  • Dialog en Android KitKat parece estar cortado
  • Falla de la aplicación android en android 4.4 debido a la negación de permisos de gps
  • Android4.4 no puede manejar la intención de sms con "vnd.android-dir / mms-sms"
  • Actualizar los datos de la zona horaria de Android
  • HTC One: DropBoxManagerService se descompone tras la actualización a KitKat 4.4.2
  • Cómo configurar el SMS predeterminado para KitKat
  • Ejecutar KitKat Virtual Device en la CPU Intel
  • Hacer que la emulación de la tarjeta de host funcione para el pago
  • Emulación de tarjeta basada en host con tarjeta fija ID
  • ¿Cómo puede la aplicación del sistema ubicada en / system / app tener permiso del sistema en Android 4.4 KitKat construir?
  • Android ActionBar transparente con ActionSherlock en v19
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.