
在Android
开发中,我们可能会遇到实现某个TextView
实现动画效果。关于这种需求,我给小伙们推荐推荐HTextView
开源库,希望能小伙伴们提高开发效率。
HTextView
这是一块帮大家实现TextView
动画效果的库。更多详细信息请查看开源库的文档
HTextView引入
写博客的时候,最新的版本是0.1.6
。小伙伴们使用的时候,可以看看有没有更新版本。引入基础模块:
implementation "com.hanks:htextview-base:0.1.6"
下面的可以按需引入:
implementation "com.hanks:htextview-fade:0.1.6"
implementation "com.hanks:htextview-line:0.1.6"
implementation "com.hanks:htextview-rainbow:0.1.6"
implementation "com.hanks:htextview-typer:0.1.6"
implementation "com.hanks:htextview-scale:0.1.6"
implementation "com.hanks:htextview-evaporate:0.1.6"
implementation "com.hanks:htextview-fall:0.1.6"
line使用以及效果
<com.hanks.htextview.line.LineTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:paddingRight="10dp"
android:text="This is LineTextView\nToday is Monday"
android:textSize="16sp"
app:animationDuration="3000"
app:lineColor="#1367bc"
app:lineWidth="4dp"/>

fade使用以及效果
<com.hanks.htextview.fade.FadeTextView
android:layout_width="240dp"
android:layout_height="150dp"
android:gravity="left"
android:letterSpacing="0.08"
android:lineSpacingMultiplier="1.3"
android:text="This is FadeTextView"
android:textColor="#fff"
android:textSize="20sp"
app:animationDuration="1500"/>

typer使用以及效果
<com.hanks.htextview.typer.TyperTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="this is init sentence."
app:charIncrease="3"
app:typerSpeed="80"/>

rainbow使用以及效果
<com.hanks.htextview.rainbow.RainbowTextView
android:layout_width="120dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="this is init sentence"
android:textSize="20sp"
app:colorSpace="150dp"
app:colorSpeed="4dp"/>

scale使用以及效果
<com.hanks.htextview.scale.ScaleTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="this is init sentence"
android:textSize="16sp"/>

evaporate使用以及效果
<com.hanks.htextview.evaporate.EvaporateTextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:gravity="center"
android:paddingTop="8dp"
android:text="this is init sentence"
android:textSize="20sp"/>

fall使用以及效果
<com.hanks.htextview.fall.FallTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="20dp"
android:text="this is init sentence"
android:textSize="16sp"/>

感觉给TextView
加动画效果还是很棒的,有机会的话可以在项目中使用到。
网友评论