Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
how can i increase the rotation speed

i want to increase the rotation speed.How can I increase the rotation speed of the ImageView in this code ??anyone please help me.I need help with this code. Thanks in advance.

public class MainActivity extends Activity {
ImageView img_one;
Button btn_one;
Random r;
int angle;
boolean restart=false;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    img_one = (ImageView) findViewById(R.id.imageView_ring);
    r=new Random();
    btn_one = (Button) findViewById(R.id.btn_1);
    btn_one.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (restart){
                 angle=angle & 360;
                angle=r.nextInt()+360;
                RotateAnimation rotate=new RotateAnimation(angle,360,RotateAnimation.RELATIVE_TO_SELF,0.5f,
                        RotateAnimation.RELATIVE_TO_SELF,0.5f);
                rotate.setFillAfter(true);
                rotate.setDuration(50);
                rotate.setInterpolator(new AccelerateDecelerateInterpolator());
                img_one.startAnimation(rotate);
                restart=false;
            }else {
                angle=r.nextInt()+360;
                RotateAnimation rotate=new RotateAnimation(0,angle,RotateAnimation.RELATIVE_TO_SELF,0.5f,
                        RotateAnimation.RELATIVE_TO_SELF,0.5f);
                rotate.setFillAfter(true);
                rotate.setDuration(50);
                rotate.setInterpolator(new AccelerateDecelerateInterpolator());
                img_one.startAnimation(rotate);
                restart=true;
            }

        }
    });
}

}

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

If you want to rotate faster, you need to lower the duration of the animation. Currently you have it set to last for 50 milliseconds:

rotate.setDuration(50);

but you can set the duration to whatever you need to achieve your desired effect.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda