字体动画HTextView

来源:互联网 发布:编写高性能的JS 编辑:程序博客网 时间:2024/05/17 22:04

这是一款非常炫酷的TextView,绝对给你惊喜。

Github地址:https://github.com/hanks-zyh/HTextView

先放几张效果图:

Default : Scale:


EvaporateText:


Fall:


fall.gif

Line:


Sparkle:


Anvil:


再说怎样使用:

在Module的build.gradle#dependencies添加

compile 'hanks.xyz:htextview-library:0.1.2'

在布局文件的根节点中添加命名空间:

xmlns:htext="http://schemas.android.com/apk/res-auto"

布局文件中添加HTextView:

<com.hanks.htextview.HTextView       android:id="@+id/htext"       android:layout_width="match_parent"       android:layout_height="100dp"       android:background="#000000"       android:gravity="center"       android:textColor="#FFFFFF"       android:textSize="30sp"       htext:animateType="anvil"       />

在java代码中使用:

hTextView = (HTextView) findViewById(R.id.text);hTextView.setAnimateType(HTextViewType.LINE);hTextView.animateText("new simple string"); // animate

Note:仅支持sdk版本15以上。

即,在Module的build.gradle#defaultConfig#minSdkVersion值为15

defaultConfig {        ...        minSdkVersion 15       ...    }


作者:食梦兽
链接:http://www.jianshu.com/p/47df0b7b76be
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
原创粉丝点击