Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cachapa/ExpandableLayout
An expandable layout container for Android
https://github.com/cachapa/ExpandableLayout
Last synced: about 1 month ago
JSON representation
An expandable layout container for Android
- Host: GitHub
- URL: https://github.com/cachapa/ExpandableLayout
- Owner: cachapa
- License: apache-2.0
- Created: 2016-05-07T18:31:33.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-02-08T13:56:05.000Z (almost 4 years ago)
- Last Synced: 2024-10-29T17:42:14.903Z (about 2 months ago)
- Language: Java
- Homepage:
- Size: 3.65 MB
- Stars: 2,337
- Watchers: 51
- Forks: 274
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-github-android-ui - ExpandableLayout - 实现动画扩展和子视图折叠 (布局)
README
# ExpandableLayout
An Android layout class that supports animating the expansion and collapse of its child views.
I built this because all of the available libraries I tested were missing features or behaving unexpectedly in certain cases (e.g. rotation handling).
This library offloads as much work as possible to the parent layout to ensure that the rendering and size calculations behave as expected. This means that even complex features such as LinearLayout's `weight` tag are properly supported.
### Try the demo
[![Google Play Store badge](https://play.google.com/intl/en_us/badges/images/badge_new.png)](https://play.google.com/store/apps/details?id=net.cachapa.expandablelayoutdemo)
### Features
ExpandableLayout supports animating:
* Views with fixed and variable heights:
![simple](images/simple.gif)
* "Accordion" expansion (using two expandable layouts)
![accordion](images/accordion.gif)
* RecyclerView items
![recycler](images/recycler.gif)
* Horizontal expansion
![horizontal](images/horizontal.gif)
### Usage
Add the Jitpack maven repository if you don't have it yet:
``` gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```Reference the library from your module's build.gradle:
``` gradle
dependencies {
[...]
implementation 'com.github.cachapa:ExpandableLayout:2.9.2'
}
```Add `ExpandableLayout` as a container to the layout or views you want to make expandable:
``` xml
```
Also supported are `el_duration` and `el_expanded` tags, for specifying the duration of the animation and whether the layout should start expanded, respectively. `el_parallax` can be set to a value between 0 and 1 to control how the child view is translated during the expansion.To trigger the animation, simply grab a reference to the ExpandableLayout from your Java code and and call either of `expand()`, `collapse()` or `toggle()`.
A full demo of the library is included with the project.
### License
Copyright 2016 Daniel Cachapa.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.### Footnotes
Gifs were generated using the following script: https://gist.github.com/cachapa/aa829bfc717fc4f1d52c568d7ae8521e