Akshay Shinde
Akshay Shinde

Reputation: 947

Android animation to replace a view object

I want to replace a view object in android where a view object will take place of another view object using animation. Please find attached image for reference.

enter image description here

I just want to slide the three dots to left side in the place of CVV_label and the right arrow should come in. again after if I click on the dots the reverse animation should be played, that means CVV_label should come in and the three dots should slide to right side.

Upvotes: 0

Views: 1359

Answers (1)

Akshay Shinde
Akshay Shinde

Reputation: 947

TranslateAnimation animation = new TranslateAnimation(0, left_text.getX()-right_text.getX(),0 , left_text.getY()-right_text.getY());
animation.setRepeatMode(0);
animation.setDuration(1000);
animation.setFillAfter(true);
right_text.startAnimation(animation);
left_text.setVisibility(View.INVISIBLE);

The above code will work for the scenario.

Upvotes: 1

Related Questions