圖片來源網(wǎng)絡(luò)搏存,入侵必刪
在Android
開發(fā)中,我們可能會遇到實現(xiàn)某個TextView
實現(xiàn)動畫效果。關(guān)于這種需求赏壹,我給小伙們推薦推薦HTextView
開源庫,希望能小伙伴們提高開發(fā)效率疟暖。
HTextView
這是一塊幫大家實現(xiàn)TextView
動畫效果的庫卡儒。更多詳細信息請查看開源庫的文檔
HTextView引入
寫博客的時候,最新的版本是0.1.6
俐巴。小伙伴們使用的時候骨望,可以看看有沒有更新版本。引入基礎(chǔ)模塊:
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"/>
line.gif
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"/>
fade.gif
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"/>
typer.gif
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"/>
rainbow.gif
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"/>
scale.gif
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"/>
evaporate.gif
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"/>
fall.gif
感覺給TextView
加動畫效果還是很棒的欣舵,有機會的話可以在項目中使用到擎鸠。