How to animate text change in TextView?

后端 未结 1 1932
长发绾君心
长发绾君心 2021-02-19 10:17

Trying to do the following:

animTimeChange = AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left); 
itemTime.startAnimation(animTimeChange);
itemTime         


        
1条回答
  •  梦如初夏
    2021-02-19 11:12

    TextSwitcher is exactly what you should be using for this. Check out the API Demo for TextSwitcher.

    The way you should implement this is in your ListAdapter, provide TextSwitcher views to the ListView instead of TextViews. Then you can just call TextSwitcher.setText() on the list item you want to change.

    Note that you should imediately get rid of your reference to the list item to avoid REALLY messing up listview.

    0 讨论(0)
提交回复
热议问题