1

Necesito rotar un ImageView a 180 grados de golpe

Ahora uso la siguiente funcion, que define una animación que dure 0 segundos

private void rotate(ImageView iv, float degree) {
    final RotateAnimation rotateAnim = new RotateAnimation(0.0f, degree,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);

    rotateAnim.setDuration(0);
    rotateAnim.setFillAfter(true);
    iv.startAnimation(rotateAnim);
}

para rotar a 180º rotate(imagen,180);

¿Me pregunto si existe una forma más eficiente? sin tener que recurrir al sistema de animación

1 respuesta 1

2

Hay una forma de rotar la imagen desde el layout sin necesidad de utilizar animaciones. Agregando el atributo rotation, te dejo un ejemplo.

<ImageView
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:scaleType="centerInside"
                android:rotation="180"
                android:src="@drawable/icon_ur_arrow"/>

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.