G
G
geron2017-04-06 13:17:17
Android
geron, 2017-04-06 13:17:17

How to make RadioButton animation?

Hello!
We need to animate the RadioButton. There are several RadioButtons in the form of a rectangular button, it has the property android:elevation="5dp". It is necessary to make it so that by clicking on the RadioButton it decreases and, as it were, pressed along the Z axis, android:elevation becomes "0dp". By clicking on another RadioButton, the previous one should return to its original size. That is, RadioButton on click should change the size and height along the z axis. Please tell me how can this be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2017-04-06
@geronix

AnimatorSet animatorSet = new AnimatorSet();

ObjectAnimator elevationDownAnimator = ObjectAnimator
    .ofFloat(mRadioView1, "elevation", 5, 0)
    .setDuration(3000);
ObjectAnimator elevationUpAnimator = ObjectAnimator
    .ofFloat(mRadioView2, "elevation", 0, 5)
    .setDuration(3000);

animatorSet
    .play(elevationDownAnimator)
    .with(elevationUpAnimator)
animatorSet.start();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question