前言html
本章内容是android.widget.TextSwitcher,译为文字转换器控件(引自系出名门系列),翻译来自madgoat ,欢迎你们访问他的博客:http://madgoat.cn/,再次感谢 madgoat !期待你一块儿参与Android API 的中文翻译,联系我over140@gmail.com。 java
声明android
欢迎转载,但请保留文章原始出处:)
ide
madgoat:http://madgoat.cn/函数
农民伯伯:http://over140.blog.51cto.com/布局
版本动画
Android 2.2 r1 this
正文spa
1、结构.net
public class TextSwitcher extends ViewSwitcher
java.lang.Object
android.view.ViewGroup
android.widget.FrameLayout
android.widget.ViewAnimator
android.widget.ViewSwitcher
android.widget.TextSwitcher
2、类概述
ViewSwitcher仅仅包含子类型TextView。TextSwitcher被用来使屏幕上的label产生动画效果。每当setText(CharSequence)被调用时,TextSwitcher使用动画方式将当前的文字内容消失并显示新的文字内容。(译者注:改变文字时增长一些动画效果)
3、构造函数
public TextSwitcher (Context context)
建立一个新的空TextSwitcher
参数
context 应用程序上下文
public TextSwitcher (Context context, AttributeSet attrs)
使用提供的context和attributes来建立一个空的TextSwitcher
参数
context 应用程序环境
attrs 属性集合
4、公共方法
public void addView (View child, int index, ViewGroup.LayoutParams params)
根据指定的布局参数新增一个子视图
参数
child 新增的子视图
index 新增子视图的位置
params 新增子视图的布局参数
抛出异常
IllegalArgumentException 当子视图不是一个TextView实例时
public void setCurrentText (CharSequence text)
设置当前显示的文本视图的文字内容。非动画方式显示。
参数
text 须要显示的新文本内容
public void setText (CharSequence text)
设置下一视图的文本内容并切换到下一视图。能够动画的退出当前文本内容,显示下一文本内容。
参数
text 须要显示的新文本内容
5、代码示例
5.1 摘自APIDemos->View->TextSwitcher
5.1.1 Java
5.1.2 XML
5.2 其余示例
http://tech.ddvip.com/2010-02/1265125017144500.html
http://www.javaeye.com/topic/569985
6、下载
CSDN:http://download.csdn.net/source/2774515
结束
madgoat很是积极,接到本章译稿后就迅速的翻译出来,而且附带完善的代码和截图,如今已经在翻译下一篇译稿,感谢他如此积极参与!