TextViewPrinter - 打字机效果显示的TextView
标签搜索

TextViewPrinter - 打字机效果显示的TextView

Pop.Kite
2023-07-12 / 0 评论 / 97 阅读 / 正在检测是否收录...

引入依赖

  1. setting.gradle下添加仓库
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        //...
        maven { url 'https://jitpack.io' }
    }
}
  1. 应用的build.gradle下添加依赖
    implementation 'com.github.popkter:PopView:v0.252'

使用方法

  1. 引用
<com.popkter.printer_textview.TextViewPrinter
            android:id="@+id/tv_set"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintBottom_toTopOf="@id/btn_get"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"/>
  1. 设置
    /**
     * setText to TextView
     * [text] the Text you want to display
     * [interpolator] Interpolator, default is AccelerateDecelerateInterpolator
     * [singleCharDuration] single char load duration, default is 200L
     * [modifyPropOnLoad] apply modify text span When Load
     * [modifyPropOnEnd] apply modify text span after Load
     */
    fun updateText(
        text: CharSequence,
        interpolator: Interpolator = AccelerateDecelerateInterpolator(),
        singleCharDuration: Long = 200L,
        modifyPropOnEnd: Boolean = true,
        modifyPropOnLoad: Boolean = true
    ) {...}

效果视频

TextViewPrinter.mp4

0

评论 (0)

取消