类似于新闻栏的文本滑动栏 [英] text-sliding bar similar to news bar

查看:71
本文介绍了类似于新闻栏的文本滑动栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发类似于在电视频道底部显示新闻的滚动新闻栏的功能。看起来像这样

I am trying to develop something similar to a scrolling news bar which displays news on the bottom of the tv channel. It would look something like this


.em Ipsum只是印刷和排版
行业的伪文本。 Lorem Ips ...

..em Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ips...

每次使用新内容从左向右移动时,都会使用新文本进行更新。我在考虑使用textview鳍状肢,但它只是从1个完整视图变为另一个视图。有什么建议可以帮助我吗?

It updates with newer text everytime it moves from left to right with newer content. I was thinking in using a textview flipper but it just changes from 1 entire view to another. Is there any recommendation that could assist me?

推荐答案

TextView txt = new TextView(this);     
txt.setText("This is moving text");      
txt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);     
txt.setTextColor(Color.rgb(187, 88, 15));     
txt.setPadding(10, 10, 0, 0);     
txt.setEllipsize(TruncateAt.MARQUEE);     
txt.setSingleLine();     
txt.setMarqueeRepeatLimit(10);     
txt.setFocusable(true);     
txt.setHorizontallyScrolling(true);     
txt.setFocusableInTouchMode(true);     
txt.requestFocus();     
txt.setLayoutParams(new TableRow.LayoutParams(130, TableRow.LayoutParams.FILL_PARENT));
txt.setTypeface(Typeface.SERIF,Typeface.BOLD); 

希望这会有所帮助。

这篇关于类似于新闻栏的文本滑动栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆