Repetir la animación de Android
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.vitesse); gpsManager = new GPSManager(); gpsManager.startListening(getApplicationContext()); gpsManager.setGPSCallback(this); Typeface tf = Typeface.createFromAsset(getAssets(), "font/DS-DIGI.TTF"); TextView loding =(TextView)findViewById(R.id.info_message); loding.setTypeface(tf); AlphaAnimation fadeIn = new AlphaAnimation(0.0f , 1.0f ) ; AlphaAnimation fadeOut = new AlphaAnimation( 1.0f , 0.0f ) ; loding.startAnimation(fadeIn); loding.startAnimation(fadeOut); fadeIn.setDuration(500); fadeOut.setDuration(1200); fadeOut.setStartOffset(1200+fadeIn.getStartOffset()+1200); measurement_index = AppSettings.getMeasureUnit(this); }
Quiero repetir este de textview loding animación hasta obtener una información de GPS
- Rotar una imagen con animación
- Ejecución Animación y conmutador de imágenes al mismo tiempo
- Cómo deslizar un ImageView de izquierda a derecha suavemente en Android?
- Problema de animación de botones de acción flotante
- Comportamiento de sombra extraño durante el cambio de tarjeta
- Ancho de la vista no cambiado después de la escala ObjectAnimator
- ¿Cómo se anima el diseño de Google Maps?
- CardView muestra artefactos cuando RotationY> 60
- PopupWindow Enter Exit La animación no funciona en Marshmallow (23)
- Animación incoherente de Android en diferentes dispositivos
- Vista de Android que desaparece cuando se sale de los padres
- Animación RecyclerView no funciona
- animateLayoutChanges no animar la eliminación de la flecha hacia atrás desde la barra de herramientas
Como esto .
animation.setRepeatCount(Animation.INFINITE);
Podrías hacer esto
animation.setRepeatCount(Animation.INFINITE); //Repeats animation indefinitely.
Android ofrece mecanismos elegantes para representar el proceso de carga. Puede utilizar un ProgressBar
indeterminado o un ImageView
con una animación de escala / alfa, en lugar de animar el propio TextView
.
Tal vez pueda encontrar esta animación útil, para animar alfa y escala al mismo tiempo. Varíe los parámetros de su preferencia:
file R.anim.alpha_scale_animation
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" > <scale android:fromXScale="0.7" android:toXScale="1.0" android:fromYScale="0.7" android:toYScale="1.0" android:pivotX="50%p" android:pivotY="50%p" android:duration="4000" android:repeatCount="infinite" /> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="2000" android:repeatMode="reverse" android:repeatCount="infinite" /> </set>
Luego para lanzarlo en su código:
Animation connectingAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.alpha_scale_animation); myView.startAnimation(connectingAnimation);
Y para detenerlo:
myView.clearAnimation(); connectingAnimation.cancel(); connectingAnimation.reset();
También puede utilizar bibliotecas como ProgressButtonView para tener tanto la interacción del usuario como el proceso de carga soportados en el mismo widget.
Espero que cualquiera de estas soluciones resulte útil para alguien 🙂
fadeIn.setRepeatCount(int count) fadeIn.setRepeatMode(AlphaAnimation.INFINITE(or any other repeat mode reletaed yo your usage))
Puede utilizar estos métodos para controlar la repetición.
Implementar esto si es necesario
//anim = your animation anim.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation arg0) { // TODO Auto-generated method stub } public void onAnimationRepeat(Animation arg0) { // TODO Auto-generated method stub } public void onAnimationEnd(Animation arg0) { } });
Si quieres detener tu animación de repente. Use yourview.clearAnimation () Espero que esto ayude.
- ¿Cómo puedo agregar efecto de degradado al color de fondo de TextView en un ListView?
- GetSystemServices es indefinido cuando se llama en un fragmento?