{"id":13643126,"url":"https://github.com/Chacojack/HiveLayoutManager","last_synced_at":"2025-04-20T21:32:58.204Z","repository":{"id":49836907,"uuid":"67792958","full_name":"Chacojack/HiveLayoutManager","owner":"Chacojack","description":null,"archived":false,"fork":false,"pushed_at":"2016-11-25T07:32:28.000Z","size":361,"stargazers_count":623,"open_issues_count":5,"forks_count":76,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-11-09T14:42:00.035Z","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/Chacojack.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}},"created_at":"2016-09-09T11:16:59.000Z","updated_at":"2024-10-25T02:21:34.000Z","dependencies_parsed_at":"2022-08-19T05:52:20.476Z","dependency_job_id":null,"html_url":"https://github.com/Chacojack/HiveLayoutManager","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/Chacojack%2FHiveLayoutManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chacojack%2FHiveLayoutManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chacojack%2FHiveLayoutManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chacojack%2FHiveLayoutManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chacojack","download_url":"https://codeload.github.com/Chacojack/HiveLayoutManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249965547,"owners_count":21352925,"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-08-02T01:01:42.204Z","updated_at":"2025-04-20T21:32:57.918Z","avatar_url":"https://github.com/Chacojack.png","language":"Java","readme":"[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/HiveLayoutManager/Lobby)\n\n# HiveLayoutManager\n\n这是一个蜂巢布局管理器，它可以在RecyclerView中实现像蜂巢一样的布局。\n\n## 1 效果展示\n\n**横向布局：**\n\n![](https://chacojack.github.io/2016/09/29/RecyclerView的一个马蜂窝布局/horizontal.png)\n\n**纵向布局：**\n\n![](https://chacojack.github.io/2016/09/29/RecyclerView的一个马蜂窝布局/vertical.png)\n\n**随机添加：**\n\n![](https://chacojack.github.io/2016/09/29/RecyclerView的一个马蜂窝布局/add.gif)\n\n**随机删除：**\n\n![](https://chacojack.github.io/2016/09/29/RecyclerView的一个马蜂窝布局/remove.gif)\n\n**随机移动：**\n\n![](https://chacojack.github.io/2016/09/29/RecyclerView的一个马蜂窝布局/move.gif)\n\n**滚动：**\n\n![](https://chacojack.github.io/2016/09/29/RecyclerView的一个马蜂窝布局/scroll.gif)\n\n## 2 使用方法\n\n### 2.1 加入依赖\n\n```\ncompile 'com.github.chacojack:hivelayoutmanager:1.0.1'\n```\n\n### 2.2 使用HiveLayoutManager\n\n\n为RecyclerView设置HiveLayoutManager即可。其中包含横向和纵向两种方向。暂时只支持在初始化的时候设置方向，不支持后期改变。\n\n```\nrecyclerView.setLayoutManager(new HiveLayoutManager(HiveLayoutManager.VERTICAL));\n```\n\n\n### 2.3 正六边形ViewHolder\n\nViewHolder使用的时候建议使用固定边长的正方形，这样比较好看。可以通过提供的`HiveDrawable`，将图片裁切为正六边形。`HiveDrawable`继承自`Drawable`，我们使用的所有视图都是`View`，使用`View`中的`setBackground(Drawable background)`即可为一个`View`设置正六边形背景。但是这种方法会让图片保持原有的大小，不会根据`View`的大小自动调整。所以建议使用一个`ImageView`来显示图片。\n\n```\nHiveDrawable drawable = new HiveDrawable(HiveLayoutManager.VERTICAL,bitmap);\nimageView.setImageDrawable(drawable);\n```\n\nViewHolder显示纯色背景：\n\n```\ndrawable.setColor(resources.getColor(getRandomColor()));\n```\n\n纯色配文字的一个简单示例：\n\n![](https://chacojack.github.io/2016/09/29/RecyclerView的一个马蜂窝布局/color.png)\n","funding_links":[],"categories":["布局"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChacojack%2FHiveLayoutManager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FChacojack%2FHiveLayoutManager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChacojack%2FHiveLayoutManager/lists"}