{"id":3730,"url":"https://github.com/JakeWharton/kotterknife","last_synced_at":"2025-08-03T23:33:55.856Z","repository":{"id":22122294,"uuid":"25452970","full_name":"JakeWharton/kotterknife","owner":"JakeWharton","description":"View \"injection\" library for Android.","archived":true,"fork":false,"pushed_at":"2019-09-12T16:12:45.000Z","size":614,"stargazers_count":2226,"open_issues_count":17,"forks_count":196,"subscribers_count":66,"default_branch":"master","last_synced_at":"2024-09-26T23:20:54.583Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/JakeWharton.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2014-10-20T06:05:55.000Z","updated_at":"2024-07-18T07:01:18.000Z","dependencies_parsed_at":"2022-09-16T11:32:03.369Z","dependency_job_id":null,"html_url":"https://github.com/JakeWharton/kotterknife","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeWharton%2Fkotterknife","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeWharton%2Fkotterknife/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeWharton%2Fkotterknife/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeWharton%2Fkotterknife/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JakeWharton","download_url":"https://codeload.github.com/JakeWharton/kotterknife/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228576887,"owners_count":17939645,"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":[],"created_at":"2024-01-05T20:16:49.790Z","updated_at":"2024-12-07T07:30:35.506Z","avatar_url":"https://github.com/JakeWharton.png","language":"Kotlin","funding_links":[],"categories":["Libraries","Kotlin","Development Alternatives","Recently Updated","\u003ca name=\"android\"\u003e\u003c/a\u003eAndroid \u003csup\u003e[Back ⇈](#android-category)\u003c/sup\u003e","开源库","开源库和框架","\u003ca name=\"dependency-injection\"\u003e\u003c/a\u003eDependency Injection \u003csup\u003e[Back ⇈](#contents)\u003c/sup\u003e","[](https://github.com/JStumpp/awesome-android/blob/master/readme.md#development-alternatives)非Java开发安卓应用"],"sub_categories":["Android","Kotlin","[Oct 28, 2024](/content/2024/10/28/README.md)","\u003ca name=\"android-libraries\"\u003e\u003c/a\u003eLibraries \u003csup\u003e[Back ⇈](#android-libraries-subcategory)\u003c/sup\u003e","依赖注入","[](https://github.com/JStumpp/awesome-android/blob/master/readme.md#kotlin)Kotlin"],"readme":"Kotter Knife\n============\n\n**Deprecated**: This was a terrible idea because it allocates an object for every view reference.\nDo not use, and do not use anything like it.\nUse [view binding](https://developer.android.com/topic/libraries/view-binding) instead.\n\n![](art/logo.png)\n\n[Butter Knife][1]-esque view binding for Kotlin.\n\n```kotlin\npublic class PersonView(context: Context, attrs: AttributeSet?) : LinearLayout(context, attrs) {\n  val firstName: TextView by bindView(R.id.first_name)\n  val lastName: TextView by bindView(R.id.last_name)\n\n  // Optional binding.\n  val details: TextView? by bindOptionalView(R.id.details)\n\n  // List binding.\n  val nameViews: List\u003cTextView\u003e by bindViews(R.id.first_name, R.id.last_name)\n\n  // List binding with optional items being omitted.\n  val nameViews: List\u003cTextView\u003e by bindOptionalViews(R.id.first_name, R.id.middle_name, R.id.last_name)\n}\n```\n\nThese methods are available on subclasses of `Activity`, `Dialog`, `ViewGroup`, `Fragment`,\nthe support library `Fragment`, and recycler view's `ViewHolder`.\n\n\n\nDownload\n--------\n\nCurrently not available via Maven Central.\n\nA SNAPSHOT is available in the Sonatype snapshot repo.\n```groovy\ncompile 'com.jakewharton:kotterknife:0.1.0-SNAPSHOT'\n```\n\nYou can also copy `ButterKnife.kt` into your source tree. The file depends on the 'support-v4' and\n'recyclerview-v7' libraries but the dependency is easily removed by deleting a few lines.\n\nComments, suggestions, and pull requests are encouraged!\n\n\n\nLicense\n-------\n\n    Copyright 2014 Jake Wharton\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]: http://jakewharton.github.io/butterknife\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJakeWharton%2Fkotterknife","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJakeWharton%2Fkotterknife","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJakeWharton%2Fkotterknife/lists"}