Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Sometimes, To make the app pages look more attractive we need to apply different animations to our mobile content and for this Android provides developers two classes namely TextSwitcher and ImageSwitcher in order to have a transition animation in an Android View. TextSwitcher is specially designed to contain only TextView as a child. It is used to animate any text on the app page. Whenever the setText(CharSequence) method is called, TextSwitcher animates the current text out and animates the new text in. TextView and TextSwitcher work in a similar way. Similarly, an ImageSwitcher replaces an ImageView. It also contains only ImageView as a child and animates the views in and out.
Let us see the steps to implemen TextSwitcher.
First we will define our XML file which will contain a TextSwitcher. Below is a sample.xml.
Now in our Activity class we will initialise this TextSwitcher.
As you can see in the above code segment first we have picked the view and the set a ViewFactory on the TextSwitcher. ViewFactory actually provide the view which will be loaded when the view is changed.Below is the example code for ViewFactory.
Now we are all set. Now whenever we call the setText function of the TextSwitcher it will change the text according to the animation applied.
That’s all !!! Just by following these simple steps you can also implement ImageSwitcher.
Thank you very much. This is Vedesh Kumar signing off.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Name
Email
Subject
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.