tvNotice = (TextSwitcher)rootView.findViewById(R.id.tv_notice); tvNotice.setFactory(new ViewSwitcher.ViewFactory() { //这里 用来创建内部的视图,这里创建TextView,用来显示文字 public View makeView() { TextView tv =new TextView(getContext()); //设置文字大小 tv.setTextSize(TypedValue.COMPLEX_UNIT_PX,getResources().getDimension(R.dimen.group_notice_font_size)); //设置文字 颜色 tv.setTextColor(getResources().getColor(R.color.font_333333)); return tv; } });
然后自己可用timer或者Thread去控制轮播,轮播中控制tvNotice的代码如下
// 设置切入动画 tvNotice.setInAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.slide_in_bottom)); // 设置切出动画 tvNotice.setOutAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.slide_out_up)); //items是一个字符串列表,index就是动态的要显示的items中的索引 tvNotice.setText(itmes.get(index).getTitle());
slide_in_bottom.
<?
slide_out_up.
<?
images/loading.gif' data-original="http://img.blog.csdn.net/20160316131310656?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" >
原标题:铜板街1
关键词: