I want to add animation in android text view so that when a text changes it should change smoothly and slowly. Like, fade in or fade out when the text changes. Is it possibl
use TextSwitcher
Array of Strings to show in TextSwitcher
String textToShow[] = {"Main HeadLine", "Your Message", "New In Technology"};
You have to set animation
mSwitcher.setInAnimation(context, android.R.anim.slide_in_left);
mSwitcher.setOutAnimation(context, android.R.anim.slide_out_right);
Animation is triggered by calling method setText(CharSequence text)
// When clicked on Button TextSwitcher will switch between texts
btnNext.setOnClickListener(new View.OnClickListener() {
public void onClick (View v) {
currentIndex++;
// If index reaches maximum reset it
if (currentIndex == messageCount) {
currentIndex = 0;
}
mSwitcher.setText(textToShow[currentIndex]);
}):
If you want to set text without animation, call method setCurrentText(CharSequence text).