{"id":13644378,"url":"https://github.com/johnkil/Android-RobotoTextView","last_synced_at":"2025-04-21T07:31:08.861Z","repository":{"id":7490995,"uuid":"8840041","full_name":"johnkil/Android-RobotoTextView","owner":"johnkil","description":"Implementation of a TextView and all its direct/indirect subclasses with native support for the Roboto fonts, includes the brand new Roboto Slab fonts.","archived":false,"fork":false,"pushed_at":"2017-07-26T11:32:54.000Z","size":11963,"stargazers_count":776,"open_issues_count":2,"forks_count":113,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-04-03T14:11:03.476Z","etag":null,"topics":["android","font","material","roboto-condensed","roboto-fonts","roboto-mono","roboto-slab","textview","typeface"],"latest_commit_sha":null,"homepage":"http://johnkil.github.io/Android-RobotoTextView","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/johnkil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-17T19:13:42.000Z","updated_at":"2025-03-23T00:52:18.000Z","dependencies_parsed_at":"2022-09-26T21:41:00.303Z","dependency_job_id":null,"html_url":"https://github.com/johnkil/Android-RobotoTextView","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnkil%2FAndroid-RobotoTextView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnkil%2FAndroid-RobotoTextView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnkil%2FAndroid-RobotoTextView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnkil%2FAndroid-RobotoTextView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnkil","download_url":"https://codeload.github.com/johnkil/Android-RobotoTextView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586244,"owners_count":21128996,"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","font","material","roboto-condensed","roboto-fonts","roboto-mono","roboto-slab","textview","typeface"],"created_at":"2024-08-02T01:02:02.150Z","updated_at":"2025-04-21T07:31:03.846Z","avatar_url":"https://github.com/johnkil.png","language":"Java","readme":"Android-RobotoTextView\n======================\n\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Android--RobotoTextView-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/471)\n\nImplementation of a [TextView][6] and all its direct/indirect subclasses with native support for the [Roboto][5] fonts, includes the brand new [Roboto Slab][3] and [Roboto Mono][4] fonts.\n\nSupported fonts:\n\n* [Roboto][1]\n* [Roboto Condensed][2]\n* [Roboto Slab][3]\n* [Roboto Mono][4]\n\n![image](https://raw.githubusercontent.com/johnkil/Android-RobotoTextView/master/art/RobotoTextView.jpg)\n\n\u003ca href=\"http://play.google.com/store/apps/details?id=com.devspark.robototextview\"\u003e\n  \u003cimg alt=\"Get it on Google Play\"\n       src=\"http://www.android.com/images/brand/get_it_on_play_logo_small.png\" /\u003e\n\u003c/a\u003e\n\n\nDeprecated :cry:\n----------\n\nThis project is deprecated in favor of the [native implementation](https://developer.android.com/preview/features/fonts-in-xml.html) introduced in Android O.\n\n\nCompatibility\n-------------\n\nThis library is compatible from API 14 (Android 4.0).\n\n\nDownload\n--------\n\nGradle:\n\n```groovy\ncompile 'com.github.johnkil.android-robototextview:robototextview:4.0.0'\n```\n\nMaven:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.johnkil.android-robototextview\u003c/groupId\u003e\n    \u003cartifactId\u003erobototextview\u003c/artifactId\u003e\n    \u003cversion\u003e4.0.0\u003c/version\u003e\n    \u003ctype\u003eaar\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n\nUsage\n-----\n\n#### In XML\n\nTo set up a typeface you must specify the parameter `robotoTypeface`:\n\n``` xml\n\u003ccom.devspark.robototextview.widget.RobotoTextView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    app:robotoTypeface=\"roboto_light_italic\"/\u003e\n```\n\nor specify a set of parameters `robotoFontFamily`, `robotoTextWeight` and `robotoTextStyle`:\n``` xml\n\u003ccom.devspark.robototextview.widget.RobotoTextView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    app:robotoFontFamily=\"roboto\"\n    app:robotoTextWeight=\"light\"\n    app:robotoTextStyle=\"italic\"/\u003e\n```\n\nSet up typeface in code:\n\n#### In Code\n\nUsing parameter `typeface`:\n``` java\nRobotoTextView textView = new RobotoTextView(context);\nRobotoTypefaces.setUpTypeface(\n        textView, \n        RobotoTypefaces.TYPEFACE_ROBOTO_LIGHT_ITALIC);\n```\n\nUsing parameters `fontFamily`, `textWeight` and `textStyle`:\n``` java\nRobotoTextView textView = new RobotoTextView(context);\nRobotoTypefaces.setUpTypeface(\n        textView, \n        RobotoTypefaces.FONT_FAMILY_ROBOTO,\n        RobotoTypefaces.TEXT_WEIGHT_LIGHT,\n        RobotoTypefaces.TEXT_STYLE_ITALIC);\n```\n\n#### With Span\n\nUsing parameter `typeface`:\n``` java\nRobotoTypefaceSpan span = new RobotoTypefaceSpan(\n        context, \n        RobotoTypefaces.TYPEFACE_ROBOTO_LIGHT_ITALIC);\nSpannable spannable = new SpannableString(\"text\");\nspannable.setSpan(span, 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);\n```\n\nUsing parameters `fontFamily`, `textWeight` and `textStyle`:\n``` java\nRobotoTypefaceSpan span = new RobotoTypefaceSpan(\n        context,\n        RobotoTypefaces.FONT_FAMILY_ROBOTO,\n        RobotoTypefaces.TEXT_WEIGHT_LIGHT,\n        RobotoTypefaces.TEXT_STYLE_ITALIC);\nSpannable spannable = new SpannableString(\"text\");\nspannable.setSpan(span, 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);\n```\n\n#### Roboto Inflater\n\nTo apply roboto typeface for original TextView (like a [Calligraphy][7]) you must attach inflater in your `Activity` class in the `#onCreate()` method.\n```java\n@Override\nprotected void onCreate(@Nullable Bundle savedInstanceState) {\n    RobotoInflater.attach(this);\n    super.onCreate(savedInstanceState);\n}\n```\n\nand specify the typeface in xml:\n``` xml\n\u003cTextView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    app:robotoTypeface=\"roboto_light_italic\"\n    tools:ignore=\"MissingPrefix\"/\u003e\n```\n\n_Note: Popular IDE's (Android Studio, IntelliJ) will likely mark this as an error despite being correct. You may want to add `tools:ignore=\"MissingPrefix\"` to either the View itself or its parent ViewGroup to avoid this. You'll need to add the tools namespace to have access to this \"ignore\" attribute. `xmlns:tools=\"\nhttp://schemas.android.com/tools\"`. See https://code.google.com/p/android/issues/detail?id=65176._\n\n\nGradle\n------\n\nIf you intend to use is not all fonts, the extra fonts can be removed.\n\n```groovy\nandroid.applicationVariants.all{ variant -\u003e\n    variant.mergeAssets.doLast {\n        File fonts = file(\"$variant.mergeAssets.outputDir/fonts\")\n        if (fonts.exists()) {\n            for (File file : fonts.listFiles()) {\n                if (file.getName().contains(\"RobotoSlab\")) {\n                    println(\"delete \" + file.getName() + \" font\")\n                    file.delete()\n                }\n            }\n        }\n    }\n}\n```\n\n\nLicense\n-------\n\n    Copyright 2014 Evgeny Shishkin\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\n\n[1]: https://www.google.com/fonts/specimen/Roboto\n[2]: https://www.google.com/fonts/specimen/Roboto+Condensed\n[3]: https://www.google.com/fonts/specimen/Roboto+Slab\n[4]: https://www.google.com/fonts/specimen/Roboto+Mono\n[5]: http://www.google.com/design/spec/style/typography.html\n[6]: http://developer.android.com/reference/android/widget/TextView.html\n[7]: https://github.com/chrisjenx/Calligraphy\n\n[0]: https://github.com/google/roboto\n","funding_links":[],"categories":["TextView","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnkil%2FAndroid-RobotoTextView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnkil%2FAndroid-RobotoTextView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnkil%2FAndroid-RobotoTextView/lists"}