ExpandableLayout
An expandable layout that shows a two-level layout with an indicator.
Including in your project
Gradle
Add below codes to your root build.gradle
file (not your module build.gradle file).
And add a dependency code to your module's build.gradle
file.
Usage
Add following XML namespace inside your XML layout file.
ExpandableLayout
Here is a basic example of implementing ExpandableLayout
.
Create using builder class
We can create an instance of ExpandableLayout
using the builder class.
Expand and Collapse
We can expand and collapse using the below methods.
ParentLayout and SecondLayout
We can get the parentLayout
and secondLayout
of the ExpandableLayout
.
And we can access child views of them.
OnExpandListener
We can listen to the ExpandableLayout
is expanded or collapsed.
ExpandableLayout Attributes
Attributes | Type | Default | Description |
---|---|---|---|
isExpanded | Boolean | false | Expand the second layout initially or not. |
parentLayout | layout | default layout | Sets the parent layout. |
secondLayout | layout | default layout | Sets the second layout. |
duration | Long | 250L | Sets the duration of the spinner animation. |
spinner | Drawable | arrow_down | Sets the spinner's drawable. |
showSpinner | Boolean | true | Shows the spinner or not. |
Spinner_animate | Boolean | true | Animates the spinner when expanding or collapse. |
Spinner_rotation | Integer | -180 | Sets the rotation of the spinner animation. |
Spinner_size | Dimension | 36dp | Sets the size of the spinner. |
Spinner_margin | Dimension | 8dp | Sets the margin of the spinner. |