{"id":18001546,"url":"https://github.com/hehonghui/segmentview","last_synced_at":"2025-03-26T08:30:49.546Z","repository":{"id":30937708,"uuid":"34495722","full_name":"hehonghui/SegmentView","owner":"hehonghui","description":"This is a Android Segment Control ( View ) like iOS, support 2.3 and above.","archived":false,"fork":false,"pushed_at":"2015-04-24T03:47:00.000Z","size":284,"stargazers_count":39,"open_issues_count":0,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T11:50:36.729Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.devtf.cn","language":"Java","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/hehonghui.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}},"created_at":"2015-04-24T03:23:42.000Z","updated_at":"2023-10-28T09:16:56.000Z","dependencies_parsed_at":"2022-08-03T15:16:00.963Z","dependency_job_id":null,"html_url":"https://github.com/hehonghui/SegmentView","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/hehonghui%2FSegmentView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2FSegmentView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2FSegmentView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2FSegmentView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hehonghui","download_url":"https://codeload.github.com/hehonghui/SegmentView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245618564,"owners_count":20645023,"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-10-29T23:17:55.214Z","updated_at":"2025-03-26T08:30:49.060Z","avatar_url":"https://github.com/hehonghui.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SegmentView\nThis is a Android Segment Control ( View ) like iOS.\n\n**Horizontal :**      \n![gif](images/segment.png)\n\n**Vertical :**      \n![gif](images/tab-v.png)\n\n## 效果图\n![gif](images/tab.gif)\n\n## 使用\n1、 引用SegmentView工程;      \n2、在项目的xml中加入如下代码 :       \n\n```xml\n\u003ccom.simple.widgets.SegmentView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/rg\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    android:layout_centerHorizontal=\"true\"\n    android:layout_gravity=\"top|center\"\n    android:layout_margin=\"10dp\"\n    android:background=\"@drawable/segment_shape\"\n    android:gravity=\"center\"\n    android:orientation=\"horizontal\" /\u003e\n```   \n3、 代码中设置tabs和回调。\n\n```java\nSegmentView rGroup = (SegmentView) findViewById(R.id.rg);\n// 默认为横向排列，如上图所示，如需纵向排列请调用setOrientation方法\n// rGroup.setOrientation(SegmentView.VERTICAL);\n\n// 设置tabs\nrGroup.setTabs(new String[] {\n                \"主页\", \"朋友圈\", \"搜索\"\n        });\n// 设置点击事件\nrGroup.setOnItemCheckedListener(new OnItemCheckedListener() {\n\n      @Override\n      public void onCheck(RadioButton button, int position, String title) {\n             Toast.makeText(getApplicationContext(),\n                        \"checked id = \" + position + \", title = \" + title,\n                        Toast.LENGTH_SHORT).show();\n      }\n });\n```\n\n## License \n\n```\nThe MIT License (MIT)\n\nCopyright (c) 2015 Mr.Simple\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%2Fhehonghui%2Fsegmentview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhehonghui%2Fsegmentview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhehonghui%2Fsegmentview/lists"}