/toggle-layout

Android Layout to toggle expanding and collapsing of views with animations.

Primary LanguageJavaMIT LicenseMIT

Android Toggle Layout

Release Downloads License

An extension of LinearLayout that allows users to expand and collapse views using fade down and fade up animations.

  • Configurable. Minimum children to show while collapsed.
  • Saved State. State is preserved upon screen rotation or recreation.
  • Animated - Transitions to expanded and collapsed states.
  • Thread safety - Expand and collapse animations do not interrupt, override or queue after each other. Users only trigger transitions after state has been completed.

Requirements

  • Android SDK 1.0+.

Installation

repositories {
     jcenter()
     maven { url "https://jitpack.io" }
}
dependencies {
     implementation 'com.github.philip-bui:toggle-layout:1.0.0'
}

Usage

<com.nextgeneration.ToggleLayout
	...
	app:minChildren="1">

</com.nextgeneration.ToggleLayout>
ToggleLayout toggleLayout = null;
toggleLayout.expand(); // Expands or maintains expanded state.
toggleLayout.collapse(); // Collapses or maintains collapsed state.
toggleLayout.toggle(); // Expands or collapses depending on state.

License

ToggleLayout is available under the MIT license. See LICENSE for details.