客户端中消息的轮换出现 TextSwitcher

来源:互联网 发布:centos 中文输入法 编辑:程序博客网 时间:2024/06/06 07:26

经常在应用中看到几条消息轮换着出现,我们也就实现这么个简单的功能,直接引用TextSwitcher这个控件就足以解决。。。

textswitcher= (TextSwitcher) this.findViewById(R.id.textswitcher);textswitcher.setFactory(this);Animation in = AnimationUtils.loadAnimation(this, R.anim.slide_in_bottom);Animation out = AnimationUtils.loadAnimation(this, R.anim.abc_slide_out_top);textswitcher.setInAnimation(in);textswitcher.setOutAnimation(out);
@Overridepublic View makeView() {    TextView textView = new TextView(this);    textView.setTextSize(36);    return textView;}
这样就完成了,上面的动画可以根据自己的需求进行定制。。

1 0
原创粉丝点击