如何在TextView中为文本更改设置动画?

LA_*_*LA_ 13 android textview android-animation android-listview

尝试执行以下操作:

animTimeChange = AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left); 
itemTime.startAnimation(animTimeChange);
itemTime.setText("new text");
Run Code Online (Sandbox Code Playgroud)

但是动画通过空白屏幕发生(即原始文本被清除,然后新动画显示动画).如何避免那个空白屏幕?

(我TextViewListView行的一部分,我试图使用TextSwitcher- 它无法正常工作 ;因为ViewFlipper- 我不知道在哪里添加视图,因为这是其中的一部分ListView)

Cod*_*ile 14

TextSwitcher正是您应该使用的.查看TextSwitcherAPI演示.

你应该在ListAdapter中实现它的方式,为ListView而不是TextViews提供TextSwitcher视图.然后,您可以在要更改的列表项上调用TextSwitcher.setText().

请注意,您应该立即删除对列表项的引用,以避免真正搞乱listview.