{"id":25244175,"url":"https://github.com/amilcar-sr/justifiedtextview","last_synced_at":"2025-04-05T17:05:16.533Z","repository":{"id":18638677,"uuid":"21845095","full_name":"amilcar-sr/JustifiedTextView","owner":"amilcar-sr","description":"JustifiedTextView is an android view that justifies the text. Gives support to older Android versions because \"setJustificationMode\" was introduced until API 26.","archived":false,"fork":false,"pushed_at":"2018-11-06T17:10:14.000Z","size":284,"stargazers_count":296,"open_issues_count":6,"forks_count":40,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-05T17:04:36.920Z","etag":null,"topics":["android","backward-compatibility","java","justified-text"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amilcar-sr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-15T03:36:17.000Z","updated_at":"2025-03-17T09:39:28.000Z","dependencies_parsed_at":"2022-09-12T05:10:06.197Z","dependency_job_id":null,"html_url":"https://github.com/amilcar-sr/JustifiedTextView","commit_stats":null,"previous_names":["amilcar-sr/jtext"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amilcar-sr%2FJustifiedTextView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amilcar-sr%2FJustifiedTextView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amilcar-sr%2FJustifiedTextView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amilcar-sr%2FJustifiedTextView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amilcar-sr","download_url":"https://codeload.github.com/amilcar-sr/JustifiedTextView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369952,"owners_count":20927928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","backward-compatibility","java","justified-text"],"created_at":"2025-02-12T01:17:59.806Z","updated_at":"2025-04-05T17:05:16.509Z","avatar_url":"https://github.com/amilcar-sr.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"JustifiedTextView\n=========\n[![Maven Central](https://img.shields.io/maven-central/v/com.codesgood/justifiedtextview.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.codesgood%22%20AND%20a:%22justifiedtextview%22) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-JustifiedTextView-green.svg?style=flat)](https://android-arsenal.com/details/1/7273)\n\nJustifiedTextView is an Android View that justifies the Text! 🙌🏻 \n\nAndroid introduced in **API level 26** the method [setJustificationMode(int)](https://developer.android.com/reference/android/widget/TextView.html#setJustificationMode(int)), which is meant to justify the text inside a TextView.\n\nIf your min API level is 26, I recommend **TextView.setJustificationMode(int)**. But if you need to support older Android versions, JustifiedTextView is what you need 😉\n\n\n![alt landscape](https://raw.githubusercontent.com/amilcar-sr/amilcar-sr.github.io/master/JustifiedTextView/landscape.png)\n\n\n![alt portrait](https://raw.githubusercontent.com/amilcar-sr/amilcar-sr.github.io/master/JustifiedTextView/portrait.png)\n\n\n\n## Usage\n\nYou just have to add the view in your layout:\n\n```xml\n\u003ccom.codesgood.views.JustifiedTextView\n        android:id=\"@+id/tv_justified_paragraph\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:padding=\"10dp\"\n        android:text=\"@string/lorem_ipsum_extended\"\n        android:textColor=\"@android:color/black\"\n        android:textSize=\"15sp\" /\u003e\n```\n\n**And that's it!** 🎉 the text contained in the JustifiedTextView will be justified. (In this example I used 15sp as textSize, but you can use a different textSize and it won't be a problem).\n\n**You can set the text programmatically as well** 👍🏻, you can even use JustifiedTextView as a regular TextView in your java class (because it extends TextView) and the result would be the same justified text in your UI. \n\nHere is an example:\n\n```java\nTextView justifiedParagraph = findViewById(R.id.tv_justified_paragraph);\njustifiedParagraph.setText(R.string.lorem_ipsum_extended);\n````\n\n\n## Add JustifiedTextView to your project\n\nJustifiedTextView is available on Maven Central. Please make sure you're using the latest version by [checking here](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.codesgood%22%20AND%20a%3A%22justifiedtextview%22)\n\nGradle:\n```\nimplementation 'com.codesgood:justifiedtextview:1.1.0'\n```\n\nMaven:\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.codesgood\u003c/groupId\u003e\n    \u003cartifactId\u003ejustifiedtextview\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\n## Thanks\n\n- [Rose Hulman Institute of Technology (Algorithm source)](https://www.rose-hulman.edu/class/csse/csse221/200910/Projects/Markov/justification.html)\n\n\n## License\n\n    Copyright 2014 CodesGood\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Familcar-sr%2Fjustifiedtextview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Familcar-sr%2Fjustifiedtextview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Familcar-sr%2Fjustifiedtextview/lists"}