{"id":13611538,"url":"https://github.com/skydoves/ExpandableLayout","last_synced_at":"2025-04-13T04:34:48.988Z","repository":{"id":47898253,"uuid":"211625959","full_name":"skydoves/ExpandableLayout","owner":"skydoves","description":"🦚 An expandable layout that shows a two-level layout with an indicator.","archived":false,"fork":false,"pushed_at":"2021-05-12T14:16:24.000Z","size":374,"stargazers_count":836,"open_issues_count":13,"forks_count":54,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-04T02:08:54.331Z","etag":null,"topics":["android","android-library","collapse","expand","expandable","expandablelayout","kotlin","skydoves"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/skydoves.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"github":"skydoves","custom":["https://www.paypal.me/skydoves","https://www.buymeacoffee.com/skydoves"]}},"created_at":"2019-09-29T07:56:22.000Z","updated_at":"2025-04-01T02:23:14.000Z","dependencies_parsed_at":"2022-09-09T09:31:14.291Z","dependency_job_id":null,"html_url":"https://github.com/skydoves/ExpandableLayout","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skydoves%2FExpandableLayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skydoves%2FExpandableLayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skydoves%2FExpandableLayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skydoves%2FExpandableLayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skydoves","download_url":"https://codeload.github.com/skydoves/ExpandableLayout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248646809,"owners_count":21139077,"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":["android","android-library","collapse","expand","expandable","expandablelayout","kotlin","skydoves"],"created_at":"2024-08-01T19:01:57.262Z","updated_at":"2025-04-13T04:34:48.968Z","avatar_url":"https://github.com/skydoves.png","language":"Kotlin","readme":"\u003ch1 align=\"center\"\u003eExpandableLayout\u003c/h1\u003e\u003c/br\u003e\n\n\u003cp align=\"center\"\u003e\n🦚 An expandable layout that shows a two-level layout with an indicator.\n\u003c/p\u003e\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://android-arsenal.com/api?level=16\"\u003e\u003cimg alt=\"API\" src=\"https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://travis-ci.org/skydoves/ExpandableLayout\"\u003e\u003cimg alt=\"Travis\" src=\"https://travis-ci.org/skydoves/ExpandableLayout.svg?branch=master\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://androidweekly.net/issues/issue-382\"\u003e\u003cimg alt=\"Android Weekly\" src=\"https://img.shields.io/badge/Android%20Weekly-%23382-orange\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://skydoves.github.io/libraries/expandablelayout/javadoc/expandablelayout/com.skydoves.expandablelayout/index.html\"\u003e\u003cimg alt=\"Javadoc\" src=\"https://img.shields.io/badge/Javadoc-ExpandableLayout-yellow\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/24237865/67871177-4b05e880-fb73-11e9-8de8-965a9e67aa1e.gif\" width=\"32%\"/\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/24237865/65830792-bd25ac00-e2ed-11e9-8ce5-890db409ea05.gif\" width=\"32%\"/\u003e\n\u003c/p\u003e\n\n## Including in your project\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.skydoves/expandablelayout.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.skydoves%22%20AND%20a:%22expandablelayout%22)\n[![Jitpack](https://jitpack.io/v/skydoves/ExpandableLayout.svg)](https://jitpack.io/#skydoves/ExpandableLayout)\n### Gradle \nAdd below codes to your **root** `build.gradle` file (not your module build.gradle file).\n```gradle\nallprojects {\n    repositories {\n        mavenCentral()\n    }\n}\n```\nAnd add a dependency code to your **module**'s `build.gradle` file.\n```gradle\ndependencies {\n    implementation \"com.github.skydoves:expandablelayout:1.0.7\"\n}\n```\n\n## Usage\nAdd following XML namespace inside your XML layout file.\n\n```gradle\nxmlns:app=\"http://schemas.android.com/apk/res-auto\"\n```\n\n\n### ExpandableLayout\nHere is a basic example of implementing `ExpandableLayout`.\n\n```gradle\n\u003ccom.skydoves.expandablelayout.ExpandableLayout\n  android:id=\"@+id/expandable\"\n  android:layout_width=\"match_parent\"\n  android:layout_height=\"wrap_content\"\n  android:layout_marginTop=\"30dp\"\n  app:expandable_duration=\"300\"\n  app:expandable_isExpanded=\"false\" // expand the second layout initially or not.\n  app:expandable_parentLayout=\"@layout/layout_parent\" // sets the parent layout. \n  app:expandable_secondLayout=\"@layout/layout_second\" // sets the second layout.\n  app:expandable_showSpinner=\"true\" // shows the spinner or not.\n  app:expandable_spinner=\"@drawable/ic_arrow_down\" // sets the spinner's drawable.\n  app:expandable_spinner_animate=\"true\" // animates the spinner when expanding or collapse.\n  app:expandable_spinner_margin=\"14dp\" // sets the margin to the spinner.\n  app:expandable_spinner_gravity=\"start\" // sets the gravity to the spinner.\n  app:expandable_spinner_size=\"32dp\" // sets the spinner size.\n/\u003e\n```\n\n### Create using builder class\nWe can create an instance of `ExpandableLayout` using the builder class.\n```kotlin\nval myExpandableLayout = expandableLayout(context) {\n  setParentLayoutResource(R.layout.layout_parent)\n  setSecondLayoutResource(R.layout.layout_second)\n  setShowSpinner(true)\n  setSpinnerAnimate(true)\n  setSpinnerMargin(12f)\n  setSpinnerRotation(90)\n  setDuration(200)\n  setOnExpandListener { toast(\"is expanded : $it\") }\n}\n```\n\n### Expand and Collapse\nWe can expand and collapse using the below methods.\n```kotlin\nexpandablelayout.expand() // expand the second layout with indicator animation.\nexpandablelayout.collapse() // collapse the second layout with indicator animation.\n```\n\n### ParentLayout and SecondLayout\nWe can get the `parentLayout` and `secondLayout` of the `ExpandableLayout`.\u003cbr\u003e\nAnd we can access child views of them.\n```kotlin\nexpandablelayout.parentLayout.setOnClickListener {\n  toast(\"the parent layout is clicked!\")\n}\nexpandablelayout.secondLayout.setOnClickListener {\n  toast(\"the second layout is clicked!\")\n}\n\n// getting child view using findViewById.\nexpandablelayout.secondLayout.findViewById\u003cButton\u003e(R.id.button0).setOnClickListener { \n    toast(\"button0 clicked\") \n}\n// getting child view using android extension.\nexpandablelayout.secondLayout.button0.setOnClickListener { toast(\"button0 clicked\") }\n```\n\n### OnExpandListener\nWe can listen to the `ExpandableLayout` is expanded or collapsed.\n```kotlin\nexpandablelayout.onExpandListener = object : OnExpandListener {\n  override fun onExpand(isExpanded: Boolean) {\n    toast(\"Expanded : $it\")\n  }\n}\n\n// or we can listen using a lambda expression.\nexpandable.setOnExpandListener {\n  if (it) {\n    toast(\"expanded\")\n  } else {\n    toast(\"collapse\")\n  }\n}\n```\n\n### ExpandableAnimation\nWe can customize the expanding and collapsing animation.\u003cbr\u003e\n```kotlin\nExpandableAnimation.NORMAL\nExpandableAnimation.ACCELERATE\nExpandableAnimation.BOUNCE\n```\n\nNORMAL | ACCELERATE | BOUNCE\n| :---------------: | :---------------: | :---------------: |\n| \u003cimg src=\"https://user-images.githubusercontent.com/24237865/67871179-4b9e7f00-fb73-11e9-8ffe-563d64b876b4.gif\" align=\"center\" width=\"100%\"/\u003e | \u003cimg src=\"https://user-images.githubusercontent.com/24237865/67871176-4a6d5200-fb73-11e9-8d25-26c616ca7b9d.gif\" align=\"center\" width=\"100%\"/\u003e | \u003cimg src=\"https://user-images.githubusercontent.com/24237865/67871178-4b9e7f00-fb73-11e9-9f93-fef72b2d627d.gif\" align=\"center\" width=\"100%\"/\u003e\n\n## ExpandableLayout Attributes\nAttributes | Type | Default | Description\n--- | --- | --- | ---\nisExpanded | Boolean | false | Expand the second layout initially or not.\nparentLayout | layout | default layout | Sets the parent layout.\nsecondLayout | layout | default layout | Sets the second layout.\nduration | Long | 250L | Sets the duration of the spinner animation.\nspinner | Drawable | arrow_down | Sets the spinner's drawable.\nshowSpinner | Boolean | true | Shows the spinner or not.\nspinner_animate | Boolean | true | Animates the spinner when expanding or collapse.\nspinner_rotation | Integer | -180 | Sets the rotation of the spinner animation.\nspinner_size | Dimension | 36dp | Sets the size of the spinner.\nspinner_margin | Dimension | 8dp | Sets the margin of the spinner.\nspinner_gravity | SpinnerGravity | end | Sets the gravity of the spinner.\n\n## Find this library useful? :heart:\nSupport it by joining __[stargazers](https://github.com/skydoves/ExpandableLayout/stargazers)__ for this repository. :star:\u003cbr\u003e\nAnd __[follow](https://github.com/skydoves)__ me for my next creations! 🤩\n\n# License\n```xml\nCopyright 2019 skydoves (Jaewoong Eum)\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":["https://github.com/sponsors/skydoves","https://www.paypal.me/skydoves","https://www.buymeacoffee.com/skydoves"],"categories":["Index","Kotlin"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskydoves%2FExpandableLayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskydoves%2FExpandableLayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskydoves%2FExpandableLayout/lists"}