{"id":13642120,"url":"https://github.com/Karumi/ExpandableSelector","last_synced_at":"2025-04-20T15:34:55.534Z","repository":{"id":33832044,"uuid":"37531555","full_name":"Karumi/ExpandableSelector","owner":"Karumi","description":"ExpandableSelector is an Android library created to show a list of Button/ImageButton widgets inside a animated container which can be collapsed or expanded.","archived":false,"fork":false,"pushed_at":"2018-07-20T12:02:28.000Z","size":1382,"stargazers_count":690,"open_issues_count":7,"forks_count":116,"subscribers_count":32,"default_branch":"master","last_synced_at":"2024-11-09T13:37:07.378Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Karumi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-16T13:23:50.000Z","updated_at":"2024-11-05T16:56:57.000Z","dependencies_parsed_at":"2022-07-24T18:02:06.688Z","dependency_job_id":null,"html_url":"https://github.com/Karumi/ExpandableSelector","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Karumi%2FExpandableSelector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Karumi%2FExpandableSelector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Karumi%2FExpandableSelector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Karumi%2FExpandableSelector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Karumi","download_url":"https://codeload.github.com/Karumi/ExpandableSelector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249918766,"owners_count":21345413,"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:27.789Z","updated_at":"2025-04-20T15:34:54.972Z","avatar_url":"https://github.com/Karumi.png","language":"Java","funding_links":[],"categories":["浮动菜单","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"![Karumi logo][karumilogo] ExpandableSelector [![Build Status](https://travis-ci.org/Karumi/ExpandableSelector.svg?branch=master)](https://travis-ci.org/Karumi/ExpandableSelector) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.karumi/expandableselector/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.karumi/expandableselector) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ExpandableSelector-green.svg?style=flat)](https://android-arsenal.com/details/1/1987)\n==================\n\nExpandableSelector is an Android library created to show a list of Button/ImageButton widgets inside a animated container which can be collapsed or expanded.\n\nScreenshots\n-----------\n\n![Demo Screenshot][1]\n\nUsage\n-----\n\nTo use ``ExpandableSelector`` in your application you have to follow this steps:\n\n* 1 - Add ``ExpandableSelector`` to your layout:\n\n```xml\n\n \u003ccom.karumi.expandableselector.ExpandableSelector\n      android:id=\"@+id/es_sizes\"\n      android:layout_width=\"wrap_content\"\n      android:layout_height=\"wrap_content\"/\u003e\n\n```\n\n* 2 - During your Activity/Fragment creation lifecycle create a list of ``ExpandableItem`` instances and configure them to be used inside your ``ExpandableSelector`` widget:\n\n```java\n\nprivate void initializeSizesExpandableSelector() {\n    ExpandableSelector sizesExpandableSelector = (ExpandableSelector) findViewById(R.id.es_sizes);\n    List\u003cExpandableItem\u003e expandableItems = new ArrayList\u003cExpandableItem\u003e();\n    expandableItems.add(new ExpandableItem(\"XL\"));\n    expandableItems.add(new ExpandableItem(\"L\"));\n    expandableItems.add(new ExpandableItem(\"M\"));\n    expandableItems.add(new ExpandableItem(\"S\"));\n    sizesExpandableSelector.showExpandableItems(expandableItems);\n}\n\n```\n\n* 3 - To be able to listen the animation events configure a ``ExpandableSelectorListener`` instance:\n\n```java\n\nprivate void configureExpandableSelectorListener() {\n\n    sizesExpandableSelector.setExpandableSelectorListener(new ExpandableSelectorListener() {\n          @Override public void onCollapse() {\n            //Do something here\n          }\n\n          @Override public void onExpand() {\n            //Do something here\n          }\n\n          @Override public void onCollapsed() {\n            //Do something here\n          }\n\n          @Override public void onExpanded() {\n            //Do something here\n          }\n        });\n}\n\n```\n\n* 4 - To be able to listen the click events configure a ``OnExpandableItemClickListener`` instance:\n\n```java\n\nprivate void configureExpandableSelectorClickListener() {\n\n    sizesExpandableSelector.setOnExpandableItemClickListener(new OnExpandableItemClickListener() {\n          @Override public void onExpandableItemClickListener(int index, View view) {\n             //Do something here\n          }\n        });\n}\n\n```\n\nCustomization\n-------------\n\nYou can easily customize the appearance of your ``ExpandableItem`` instances. Just asign a value to ``expandableItemSyle`` attribute in your theme and make it reference a custom style.\n\n```xml\n\n\u003cstyle name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\"\u003e\n    \u003citem name=\"expandableItemStyle\"\u003e@style/ExpandableItemStyle\u003c/item\u003e\n\u003c/style\u003e\n\n\u003cstyle name=\"ExpandableItemStyle\"\u003e\n    \u003citem name=\"android:layout_height\"\u003e@dimen/item_size\u003c/item\u003e\n    \u003citem name=\"android:layout_width\"\u003e@dimen/item_size\u003c/item\u003e\n    \u003citem name=\"android:background\"\u003e@drawable/bg_item_with_title\u003c/item\u003e\n    \u003citem name=\"android:layout_margin\"\u003e@dimen/item_margin\u003c/item\u003e\n    \u003citem name=\"android:textColor\"\u003e@color/gray\u003c/item\u003e\n    \u003citem name=\"android:textSize\"\u003e@dimen/item_text_size\u003c/item\u003e\n\u003c/style\u003e\n\n```\n\n***Remember that declaring a ``ExpandableItemStyle`` as described before with the layout height and width is mandatory to avoid inflation errors.***\n\nThe resources you can show in the Button/ImageButton widgets automatically added to ``ExpandableSelector`` are:\n\n* Background resource identifier configured as Button/ImageButton background.\n* Resource identifier configured as ImageButton image source.\n* Title configured as Button text.\n\nAll this information will be provided to the ``ExpandableSelector`` inside a ``List\u003cExpandableItem\u003e`` object created by the library user.\n\nSome extra configuration parameters can be provided from the XML like styleable attributes:\n\n```xml\n\n  \u003ccom.karumi.expandableselector.ExpandableSelector\n      xmlns:expandable_selector=\"http://schemas.android.com/apk/res-auto\"\n      android:layout_width=\"wrap_content\"\n      android:layout_height=\"wrap_content\"\n      expandable_selector:hide_background_if_collapsed=\"true\"\n      expandable_selector:hide_first_item_on_collapse=\"true\"\n      expandable_selector:expand_interpolator=\"@android:anim/accelerate_interpolator\"\n      expandable_selector:collapse_interpolator=\"@android:anim/decelerate_interpolator\"\n      expandable_selector:container_interpolator=\"@android:anim/accelerate_decelerate_interpolator\"\n      expandable_selector:animation_duration=\"100\"\u003e\n\n```\n\nThe attributes you can configure are:\n\n* expandable_selector:hide_background_if_collapsed: Changes the background associated to the ``ExpandableSelector`` widget to a transparent one while the widget is collapsed.\n* expandable_selector:hide_first_item_on_collapse: Changes the first item visibility to View.INVISIBLE when the ``ExpandableSelector`` is collapsed.\n* expandable_selector:expand_interpolator: Changes the interpolator used in the expand animation (applies to the items), you can use an interpolator available in the platform, or create your own.\n* expandable_selector:collapse_interpolator: Changes the interpolator used in the collapse animation (applies to the items).\n* expandable_selector:container_interpolator: Changes the interpolator used in the expand \u0026 collapse animation (applies to the container)\n* expandable_selector:animation_duration: Changes the animation duration in milliseconds to the one indicated.\n\nAdd it to your project\n----------------------\n\nAdd ``ExpandableSelector`` dependency to your ``build.gradle`` file\n\n```groovy\n\ndependencies{\n    compile 'com.karumi:expandableselector:1.0.0'\n}\n\n```\n\nor to your ``pom.xml`` if you are using Maven instead of Gradle\n\n```xml\n\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.karumi\u003c/groupId\u003e\n    \u003cartifactId\u003eexpandableselector\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n    \u003ctype\u003eaar\u003c/type\u003e\n\u003c/dependency\u003e\n\n```\n\nDo you want to contribute?\n--------------------------\n\nPlease, do it! We'd like to improve this library with your help :)\n\nLicense\n-------\n\n    Copyright 2015 Karumi\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]: ./art/screenshot_demo_1.gif\n[karumilogo]: https://cloud.githubusercontent.com/assets/858090/11626547/e5a1dc66-9ce3-11e5-908d-537e07e82090.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKarumi%2FExpandableSelector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKarumi%2FExpandableSelector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKarumi%2FExpandableSelector/lists"}