梦想者AndroidiOS

HTextView:非常炫酷的 TextView 效果

2015-12-25  本文已影响2887人  食梦兽

这是一款非常炫酷的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
       ...
    }
上一篇 下一篇

猜你喜欢

热点阅读