{"id":21336137,"url":"https://github.com/lcodecorex/labellayout","last_synced_at":"2025-07-27T04:07:38.469Z","repository":{"id":211028642,"uuid":"86138692","full_name":"lcodecorex/LabelLayout","owner":"lcodecorex","description":"A light but strong tags-selecter Android library. 标签(label/tag)展示/选择控件，使用简单，个性化方便。","archived":false,"fork":false,"pushed_at":"2018-04-22T07:37:17.000Z","size":910,"stargazers_count":48,"open_issues_count":1,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-12T12:44:22.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lcodecorex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-03-25T06:55:35.000Z","updated_at":"2023-07-18T03:27:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"22084801-f5b8-4fc8-bd9e-431fac8a5ea3","html_url":"https://github.com/lcodecorex/LabelLayout","commit_stats":null,"previous_names":["lcodecorex/labellayout"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lcodecorex/LabelLayout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcodecorex%2FLabelLayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcodecorex%2FLabelLayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcodecorex%2FLabelLayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcodecorex%2FLabelLayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lcodecorex","download_url":"https://codeload.github.com/lcodecorex/LabelLayout/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcodecorex%2FLabelLayout/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267298755,"owners_count":24065888,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-21T23:51:19.135Z","updated_at":"2025-07-27T04:07:38.462Z","avatar_url":"https://github.com/lcodecorex.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 最简洁的标签（label/tag）选择/展示控件----LabelLayout\nLabelLayout只是用于标签布局(layout)，搭配CheckBox使用，标签样式可以随意更换，完全没有束缚，小而精悍。（支持API 9 及以上）\n\n### Demo图\n![](art/image0.png)  ![](art/image1.jpg)  ![](art/image2.jpg)\n\n### 属性\n- label_horizontalSpacing  水平方向上标签之间的距离\n- label_verticalSpacing  竖直方向上标签之间的距离\n- label_checkboxLayout  传入CheckBox布局（也就是标签的样式） \n- label_enableDivider  是否需要在标签行间加分割线，默认为**false**\n- label_dividerHeight  行间分割线的高度\n- label_dividerColor 行间分割线的颜色\n\n### 使用\n#### 添加gradle依赖\n```\ncompile 'com.lcodecorex:labellayout:1.0.1'\n```\n\n#### 方法及回调\n1. 定义标签数据Bean实现ILabel接口\n```java\npublic interface ILabel {\n    //warning! Ids should be unique!!!\n    public String getId();\n    public String getName();\n}\n```\n注意getId()放回的id值必须是独特的，不可重复。\n\n2. layout布局\n```xml\n\u003ccom.lcodecore.LabelLayout\n    android:id=\"@+id/label_me\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:layout_margin=\"16dp\"\n    app:label_horizontalPadding=\"16dp\"\n    app:label_horizontalSpacing=\"16dp\"\n    app:label_verticalPadding=\"16dp\"\n    app:label_verticalSpacing=\"32dp\"\n    app:label_enableDivider=\"true\" /\u003e\n```\n\n2. 设置标签,使用setLabels()方法\n```java\nlabelLayout.setLabels(List\u003cILabel\u003e labels);\n```\n\n3. 添加标签选择监听器\n```java\nlabel_me.setOnCheckChangedListener(new LabelLayout.OnCheckListener() {\n            @Override\n            public void onCheckChanged(ILabel label,boolean isChecked) {}\n            \n             @Override\n             public void onBeyondMaxCheckCount() {\n             \n             }\n        });\n```\n\n4. 如果是需要选择标签，可以调用setMaxCheckCount(int)方法，选中的标签超过这个数checkListener的onBeyondMaxCheckCount()方法会被回调。\n\n6. 其它方法\n- getCheckedLabelsCount 获取当前被选中的标签数量\n- getCheckedLabelIds() 获取被选中的标签的id列表\n- getCheckedIdsAsJson() 获取json序列化之后的id的json串\n\n#### 个性化(可参考默认样式：view_label_common.xml)\n--- 主布局\n```xml\n\u003ccom.lcodecore.LabelLayout\n    android:id=\"@+id/label_all\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:layout_margin=\"16dp\"\n    app:label_horizontalPadding=\"16dp\"\n    app:label_horizontalSpacing=\"16dp\"\n    app:label_verticalPadding=\"16dp\"\n    app:label_verticalSpacing=\"32dp\"\n    app:label_checkboxLayout=\"@layout/checkbox_gray\"\n    app:label_enableDivider=\"true\" /\u003e\n```\n\n--- checkbox_gray.xml\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cCheckBox xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"32dp\"\n    android:layout_margin=\"10dp\"\n    android:background=\"@drawable/label_selector_gray\"\n    android:button=\"@null\"\n    android:paddingBottom=\"4dp\"\n    android:paddingLeft=\"13dp\"\n    android:paddingRight=\"13dp\"\n    android:paddingTop=\"4dp\"\n    android:textColor=\"#999\"\n    android:textSize=\"16sp\" /\u003e\n```\n\n--- 图一中用的CheckBox样式\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\u003c!--推荐列表用到的标签显示checkbox--\u003e\n\u003cCheckBox xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"32dp\"\n    android:background=\"@null\"\n    android:button=\"@null\"\n    android:paddingRight=\"4dp\"\n    android:textColor=\"@color/colorPrimary\"\n    android:textSize=\"12sp\" /\u003e\n```\n\n\u003e ps\n\u003e Contact me：lcodecore@163.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flcodecorex%2Flabellayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flcodecorex%2Flabellayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flcodecorex%2Flabellayout/lists"}