简易设置滚动广告

来源:互联网 发布:无线mesh网络 编辑:程序博客网 时间:2024/05/16 13:01

依赖:(注意minSdkVersion是19,少于会报错)

dependencies {      compile 'com.sdsmdg.harjot:rotatingtext:1.0.1'}

示例:

XML

<com.sdsmdg.harjot.rotatingtext.RotatingTextWrapper        android:id="@+id/custom_switcher"        android:layout_width="wrap_content"        android:layout_height="wrap_content" />

Java

RotatingTextWrapper rotatingTextWrapper = (RotatingTextWrapper) findViewById(R.id.custom_switcher);rotatingTextWrapper.setSize(35);Rotatable rotatable = new Rotatable(Color.parseColor("#FFA036"), 1000, "Word", "Word01", "Word02");rotatable.setSize(35);rotatable.setAnimationDuration(500);rotatingTextWrapper.setContent("This is ?", rotatable);

结果




更多方法

RotatingTextWrapper

属性功能描述内容setContent(...)设置实际内容。由一个字符串和Rotatables阵列组成。字体setTypeface(...)设置非旋转文本的字体尺寸的setSize(...)设置非旋转文本的大小暂停暂停(x)的暂停'第X个可旋转的方法恢复恢复(X)恢复“可旋转”的方法

可旋转

属性功能描述颜色的setColor(...)设置与可旋转相关联的旋转文本的颜色尺寸的setSize(...)设置与可旋转相关的旋转文本的大小字体setTypeface(...)设置与该可旋转相关联的旋转文本的字体插补setInterpolator(...)设置切换文本时使用的动画插值器更新持续时间setUpdateDuration(...)设置切换字之间的间隔动画持续时间setAnimationDuration(...)设置切换动画的持续时间中心对齐setCenter(...)将旋转文本对齐到textview的中心,如果设置为 true


原创粉丝点击