{"id":13643099,"url":"https://github.com/AAkira/ExpandableLayout","last_synced_at":"2025-04-20T21:32:55.791Z","repository":{"id":71686196,"uuid":"41967587","full_name":"AAkira/ExpandableLayout","owner":"AAkira","description":"[Deprecated] An android library that brings the expandable layout with various animation. You can include optional contents and use everywhere.","archived":false,"fork":false,"pushed_at":"2017-12-15T11:11:10.000Z","size":20581,"stargazers_count":1653,"open_issues_count":66,"forks_count":325,"subscribers_count":53,"default_branch":"master","last_synced_at":"2024-10-29T19:59:45.122Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/AAkira.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-09-05T16:18:24.000Z","updated_at":"2024-10-07T13:24:09.000Z","dependencies_parsed_at":"2023-02-23T13:31:23.672Z","dependency_job_id":null,"html_url":"https://github.com/AAkira/ExpandableLayout","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AAkira%2FExpandableLayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AAkira%2FExpandableLayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AAkira%2FExpandableLayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AAkira%2FExpandableLayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AAkira","download_url":"https://codeload.github.com/AAkira/ExpandableLayout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223839366,"owners_count":17211923,"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:41.614Z","updated_at":"2024-11-09T14:31:43.446Z","avatar_url":"https://github.com/AAkira.png","language":"Java","readme":"# Expandable Layout\n\nAn android library that brings the expandable layout with various animation.\nYou can include optional contents and use everywhere.\n\n[![Circle CI](https://circleci.com/gh/AAkira/ExpandableLayout.svg?style=shield\u0026circle-token=cb7464e0215aaecb740936d1d68010ee0ffd4806)](https://circleci.com/gh/AAkira/ExpandableLayout)\n[![Platform](http://img.shields.io/badge/platform-android-brightgreen.svg?style=flat)](http://developer.android.com/index.html)\n[![Language](http://img.shields.io/badge/language-java-orange.svg?style=flat)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)\n[![License](http://img.shields.io/badge/license-apache2.0-lightgrey.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ExpandableLayout-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/2456)\n[![Android Gems](http://www.android-gems.com/badge/AAkira/ExpandableLayout.svg?branch=master)](http://www.android-gems.com/lib/AAkira/ExpandableLayout)\n\n## Preview\n\n### Normal\n\n![ExpandableRelativeLayout][ExpandableRelativeLayout] ![ExpandableWeightLayout][ExpandableWeightLayout]\n\n### Example\n\n![ExampleRecyclerView][ExampleRecyclerView] ![ExampleSearch][ExampleSearch]\n![ExampleReadMore][ExampleReadMore]\n\n## Usage\n\n### ExpandableRelativeLayout\n\n#### Usage\n\nThe expandableRelativeLayout doesn't work if child views change a size. \nYou should use the ExpandableLinearLayout if there is a possibility.\n\n#### Code\n\n```java\nExpandableRelativeLayout expandableLayout\n = (ExpandableRelativeLayout) findViewById(R.id.expandableLayout);\n\n// toggle expand, collapse\nexpandableLayout.toggle();\n// expand\nexpandableLayout.expand();\n// collapse\nexpandableLayout.collapse();\n\n// move position of child view\nexpandableLayout.moveChild(0);\n// move optional position\nexpandableLayout.move(500);\n\n// set base position which is close position\nexpandableLayout.setClosePosition(500);\n```\n\n#### Layout xml\n\nadd `xmlns:app=\"http://schemas.android.com/apk/res-auto\"`\n\n```xml\n\u003ccom.github.aakira.expandablelayout.ExpandableRelativeLayout\n    android:id=\"@+id/expandableLayout\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    app:ael_expanded=\"false\"\n    app:ael_duration=\"500\"\n    app:ael_interpolator=\"bounce\"\n    app:ael_orientation=\"vertical\"\u003e\n\n    \u003cTextView\n        android:id=\"@+id/text\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"sample\" /\u003e\n    \u003cTextView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_below=\"@id/text\"\n        android:text=\"sample2\" /\u003e\n\u003c/com.github.aakira.expandablelayout.ExpandableRelativeLayout\u003e\n```\n\n### ExpandableLinearLayout\n\n#### Usage\n\nYou should use the ExpandableLinearLayout if child views may change a size. \nFor example, it gets and sets values from a server.\nAnd you should use this in recycler view.\n\n#### Code\n\n```java\n\n// resize expandable layout\n\nExpandableLinearLayout expandableLayout\n = (ExpandableLinearLayout) findViewById(R.id.expandableLayout);\n\nchild.setText(\"Sets text from a server\");\nexpandableLayout.initLayout(); // Recalculate size of children\n\n// recycler view\n// you must set a ViewHolder#setIsRecyclable(false) and ExpandableLinearLayout#setInRecyclerView(true) \n\n@Override\npublic void onBindViewHolder(final ViewHolder holder, final int position) {\n    holder.setIsRecyclable(false);\n    holder.expandableLinearLayout.setInRecyclerView(true);\n}\n```\n\n### ExpandableWeightLayout\n\n#### Usage\n\nYou should use this layout if you want to use weight attributes at expandable layout.\n\n#### Code\n\n```java\nExpandableWeightLayout expandableLayout\n = (ExpandableWeightLayout) findViewById(R.id.expandableLayout);\n\n// toggle expand, collapse\nexpandableLayout.toggle();\n// expand\nexpandableLayout.expand();\n// collapse\nexpandableLayout.collapse();\n```\n\n#### Layout xml\n\nadd `xmlns:app=\"http://schemas.android.com/apk/res-auto\"`\n\n```xml\n\u003cLinearLayout\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\"\u003e\n\n    \u003cView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"/\u003e\n\n    \u003ccom.github.aakira.expandablelayout.ExpandableWeightLayout\n        android:id=\"@+id/expandableLayout\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"3\"\n        app:ael_duration=\"1000\"\n        app:ael_interpolator=\"anticipateOvershoot\"\u003e\n\n        \u003cImageView\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_centerInParent=\"true\"\n            android:src=\"@drawable/sample\" /\u003e\n    \u003c/com.github.aakira.expandablelayout.ExpandableWeightLayout\u003e\n\n    \u003cView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"1\"/\u003e\n\u003c/LinearLayout\u003e\n```\n\n### Listener\n\n```java\n\nexpandableLayout.setListener(new ExpandableLayoutListener() {\n    @Override\n    public void onAnimationStart() {\n    }\n\n    @Override\n    public void onAnimationEnd() {\n    }\n\n    // You can get notification that your expandable layout is going to open or close.\n    // So, you can set the animation synchronized with expanding animation.\n    @Override\n    public void onPreOpen() {\n    }\n\n    @Override\n    public void onPreClose() {\n    }\n\n    @Override\n    public void onOpened() {\n    }\n\n    @Override\n    public void onClosed() {\n    }\n});\n```\n* `ExpandableLayoutListenerAdapter`\n - You can set listeners only you need. \n\n```java\n\nexpandableLayout.setListener(new ExpandableLayoutListenerAdapter() {\n    @Override\n    public void onPreOpen() {\n    }\n\n    @Override\n    public void onPreClose() {\n    }\n});\n\n```\n\n### Attributes\n\n|attribute name|description|\n|:-:|:-:|\n|ael_duration|The length of the expand or collapse animation|\n|ael_expanded|The layout is expanded if you set true|\n|ael_defaultChildIndex|The layout is expanded at index of child view. (Only `ExpandableRelativeLayout`)|\n|ael_defaultPosition|The layout is expanded at the position. (Only `ExpandableRelativeLayout`)|\n|ael_orientation|The orientation of animation(horizontal \\| vertical)|\n|ael_interpolator|Sets [interpolator](#interpolator)|\n\n### Interpolator\n\nYou can use [interpolator](http://developer.android.com/reference/android/view/animation/Interpolator.html).\nIt helps the layout animates easily.\n\n|Interpolator|value name of attribute |\n|:-:|:-:|\n|[AccelerateDecelerateInterpolator](http://developer.android.com/reference/android/view/animation/AccelerateDecelerateInterpolator.html)|accelerateDecelerate|\n|[AccelerateInterpolator](http://developer.android.com/reference/android/view/animation/AccelerateInterpolator.html)|accelerate|\n|[AnticipateInterpolator](http://developer.android.com/reference/android/view/animation/AnticipateInterpolator.html)|anticipate|\n|[AnticipateOvershootInterpolator](http://developer.android.com/reference/android/view/animation/AnticipateOvershootInterpolator.html)|anticipateOvershoot|\n|[BounceInterpolator](http://developer.android.com/reference/android/view/animation/BounceInterpolator.html)|bounce|\n|[DecelerateInterpolator](http://developer.android.com/reference/android/view/animation/DecelerateInterpolator.html)|decelerate|\n|[FastOutLinearInInterpolator](http://developer.android.com/reference/android/support/v4/view/animation/FastOutLinearInInterpolator.html)|fastOutLinearIn|\n|[FastOutSlowInInterpolator](http://developer.android.com/reference/android/support/v4/view/animation/FastOutSlowInInterpolator.html)|fastOutSlowIn|\n|[LinearInterpolator](http://developer.android.com/reference/android/view/animation/LinearInterpolator.html)|linear|\n|[LinearOutSlowInInterpolator](http://developer.android.com/reference/android/support/v4/view/animation/LinearOutSlowInInterpolator.html)|linearOutSlowIn|\n|[OvershootInterpolator](http://developer.android.com/reference/android/view/animation/OvershootInterpolator.html)|overshoot|\n\nThese are support interpolator.\nBut a case that the expandable layout extends outside doesn't work.\ne.g. AnticipateInterpolator, AnticipateOvershootInterpolator, OvershootInterpolator\nI recommend you use such a interpolator for child views in the expandable layout.\n\n* Not support\n - CycleInterpolator\n - PathInterpolator\n\n## Setup\n\n### Gradle\n\nAdd the dependency in your `build.gradle`\n\n```groovy\nbuildscript {\n\trepositories {\n\t\tjcenter()\n\t}\n}\n\ndependencies {\n\tcompile 'com.github.aakira:expandable-layout:1.6.0@aar'\n}\n```\n\n## Author\n\n### Akira Aratani\n\n* Twitter\n - [@_a_akira](https://twitter.com/_a_akira)\n* Mail\n - developer.a.akira@gmail.com\n\n### Other open source projects\n\n* [OkWear](https://github.com/AAkira/OkWear)\n\n## License\n\n```\nCopyright (C) 2015 A.Akira\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\nhttp://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\n[ExpandableRelativeLayout]: /art/ExpandableRelativeLayout.gif\n[ExpandableWeightLayout]: /art/ExpandableWeightLayout.gif\n[ExampleSearch]: /art/ExampleSearch.gif\n[ExampleRecyclerView]: /art/ExampleRecyclerview_v1.1.gif\n[ExampleReadMore]: /art/ExampleReadMore.gif\n","funding_links":[],"categories":["布局","Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAAkira%2FExpandableLayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAAkira%2FExpandableLayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAAkira%2FExpandableLayout/lists"}