Android-推薦一個(gè)TextView實(shí)現(xiàn)動(dòng)畫效果的庫(HTextView)

圖片來源網(wǎng)絡(luò),入侵必刪

Android開發(fā)中,我們可能會(huì)遇到實(shí)現(xiàn)某個(gè)TextView實(shí)現(xiàn)動(dòng)畫效果。關(guān)于這種需求,我給小伙們推薦推薦HTextView開源庫,希望能小伙伴們提高開發(fā)效率。

HTextView

這是一塊幫大家實(shí)現(xiàn)TextView動(dòng)畫效果的庫。更多詳細(xì)信息請(qǐng)查看開源庫的文檔

HTextView引入

寫博客的時(shí)候,最新的版本是0.1.6。小伙伴們使用的時(shí)候,可以看看有沒有更新版本。引入基礎(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加動(dòng)畫效果還是很棒的,有機(jī)會(huì)的話可以在項(xiàng)目中使用到。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容