Git Product home page Git Product logo

autofittextview's Introduction

AutoFitTextView

A TextView that automatically fit 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 can handle 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 handle them.

Note that even though the sample is of API 16, it should work fine on most cases for much older versions.

A nice example of how to use an EditText that has this functionality can be found here (didn't test it, but it looks promising).

Preview

preview animation

Import using Gradle

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

	dependencies {
        compile 'com.github.AndroidDeveloperLB:AutoFitTextView:XXX'
}

You can find recent version here (replace XXX):

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

Known issues

  • API 12-15 (including) of Android might have issues as a cause of this known bug, but in most cases it should work fine there too.

  • On very rare cases, the last character of a line goes to the next line. If you know how to fix it, please write down about it.

autofittextview's People

Contributors

androiddeveloperlb avatar fomojola avatar gboudreau avatar hmperson1 avatar miguelbcr avatar mpekalski avatar riyase avatar samskiter avatar scottbez1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.