{"id":20930506,"url":"https://github.com/liangjingkanji/spannable","last_synced_at":"2025-04-05T00:04:59.286Z","repository":{"id":40297113,"uuid":"442247787","full_name":"liangjingkanji/spannable","owner":"liangjingkanji","description":"Android最好的Spannable富文本工具, 唯一支持正则匹配/图文混排/图标/GIF动画/自定义表情包","archived":false,"fork":false,"pushed_at":"2023-08-10T01:44:32.000Z","size":1216,"stargazers_count":636,"open_issues_count":0,"forks_count":50,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-28T23:02:58.977Z","etag":null,"topics":["image-span","regex","spannable"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liangjingkanji.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-27T18:58:16.000Z","updated_at":"2025-03-23T08:22:56.000Z","dependencies_parsed_at":"2024-11-18T21:40:39.388Z","dependency_job_id":"1ba8acfa-e9fb-4692-8b1d-ae80a0f86b5e","html_url":"https://github.com/liangjingkanji/spannable","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangjingkanji%2Fspannable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangjingkanji%2Fspannable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangjingkanji%2Fspannable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangjingkanji%2Fspannable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liangjingkanji","download_url":"https://codeload.github.com/liangjingkanji/spannable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266563,"owners_count":20910836,"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":["image-span","regex","spannable"],"created_at":"2024-11-18T21:34:36.635Z","updated_at":"2025-04-05T00:04:59.262Z","avatar_url":"https://github.com/liangjingkanji.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e \u003cstrong\u003eSpannable和创建字符串一样简单\u003c/strong\u003e \u003c/p\u003e\n\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/liangjingkanji/spannable/master/preview_img.png\" width=\"450\"/\u003e\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/21078112/184396518-4022db12-0fa9-48a0-97c1-22960db9362b.png\" width=\"350\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://jitpack.io/#liangjingkanji/spannable\"\u003e\u003cimg src=\"https://jitpack.io/v/liangjingkanji/spannable.svg\"/\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/language-kotlin-orange.svg\"/\u003e\n\u003cimg src=\"https://img.shields.io/badge/license-MIT-blue\"/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/liangjingkanji/liangjingkanji/master/img/group.svg\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/liangjingkanji/spannable/releases/latest/download/spannale-sample.apk\"\u003e下载体验\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/21078112/163671712-0a8644b3-8875-489e-a1e5-f8f3215ff4fc.png\" width=\"550\"/\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n让Spannable和字符串一样易用, 快速构建常见的富文本/图文混排/表情包/图标\n\n1. 全网第一个实现**正则替换**\n2. 全网第一个同时实现加载`Drawable/网络图片/Shape/点九图`格式\n\n## 特点\n\n- [x] 低学习成本(仅四个函数)\n- [x] 首个支持替换/正则/反向捕获组Span的库\n- [x] 全部使用CharSequence接口, 使用起来和字符串没有区别\n- [x] 没有自定义控件/没有多余函数\n- [x] 快速实现图文混排/富文本/自定义表情包/图标\n- [x] 输入框富文本/表情包, 可监听剪贴板粘贴/手动输入文本渲染\n\n## 函数\n\n使用的函数非常简单\n\n| 函数             | 介绍                                    |\n| ---------------- | --------------------------------------- |\n| setSpan          | 设置Span                                |\n| addSpan          | 添加/插入Span或字符串                   |\n| replaceSpan      | 替换/正则匹配Span或字符串               |\n| replaceSpanFirst/replaceSpanLast | 替换第一个/最后一个匹配的Span或字符串 |\n\n## 文本效果-Span\n本框架会收集一些常用的Span效果实现, **欢迎贡献代码**\n\n| Span | 描述 |\n|-|-|\n| CenterImageSpan | 垂直对齐方式/图片宽高/固定图片比例/显示文字/自适应文字宽高/Shape/.9图 |\n| GlideImageSpan | 网络图片/GIF动画/垂直对齐方式/图片宽高/固定图片比例/显示文字/自适应文字宽高, Require [Glide](https://github.com/bumptech/glide) |\n| MarginSpan | 文字间距 |\n| ColorSpan | 快速创建文字颜色 |\n| HighlightSpan | 创建字体颜色/字体样式/可点击效果 |\n| ClickableMovementMethod | 等效LinkMovementMethod, 但没有点击背景色 |\n\n\n\n本工具将保持简单和扩展性, 如果你想使用dsl构建span可以使用[SpannableX](https://github.com/TxcA/SpannableX)\n\n## 安装\n\n在项目根目录的 settings.gradle 添加仓库\n\n```kotlin\ndependencyResolutionManagement {\n    repositories {\n        // ...\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\n\n然后在 module 的 build.gradle 添加依赖框架\n\n```groovy\nimplementation 'com.github.liangjingkanji:spannable:1.2.7'\n```\n\n\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2023 劉強東\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliangjingkanji%2Fspannable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliangjingkanji%2Fspannable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliangjingkanji%2Fspannable/lists"}