SkillAgentSearch skills...

AutoFitTextView

A TextView that automatically fit its font and line count based on its available size and content

Install / Use

/learn @AndroidDeveloperLB/AutoFitTextView
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Release

AutoFitTextView

A TextView that automatically fits its font and line count based on its available size and content.

This code is heavily based on this StackOverflow thread.

The sample shows how the library handles various parameters being changed on the TextView: width, height, number of lines allowed, and the content (text) itself. You can play with the various properties to see how the library handles them.

Note: The library is updated to use Kotlin DSL, modern AndroidX libraries, and has a minimum SDK requirement of 21.

Preview

preview animation

Import using Gradle (Kotlin DSL)

Add JitPack to your settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        ...
        maven { url = uri("https://jitpack.io") }
    }
}

Add the dependency to your module build.gradle.kts:

dependencies {
    implementation("com.github.AndroidDeveloperLB:AutoFitTextView:XXX")
}

You can find the recent version here (replace XXX):

https://jitpack.io/#AndroidDeveloperLB/AutoFitTextView

View on GitHub
GitHub Stars917
CategoryContent
Updated12d ago
Forks154

Languages

Kotlin

Security Score

95/100

Audited on Mar 20, 2026

No findings