Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cmfsotelo/FlipLayout

ViewGroup to easily swap between added views.
https://github.com/cmfsotelo/FlipLayout

Last synced: 3 months ago
JSON representation

ViewGroup to easily swap between added views.

Awesome Lists containing this project

README

        

# FlipLayout
[![](https://jitpack.io/v/cmfsotelo/fliplayout.svg)](https://jitpack.io/#cmfsotelo/fliplayout)
![Minimum SDK](https://img.shields.io/badge/minSdkVersion%20-15-blue.svg)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-FlipLayout-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5751)

Use the FlipLayout as a ViewGroup to easily swap between child views.

Include in your project


In your root/build.gradle

```groovy
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```

In your app/build.gradle

```groovy
dependencies {
compile 'com.github.cmfsotelo:fliplayout:latest.version.here'
}
```

Usage


Simply use the FrameLayout public methods to change which view is visible.

```java
/**
* Shows the child next to the one being shown, animating it. If the current child is the last one, the first child shown.
*/
public void showNextChild();

/**
* Shows the child previous to the one being shown, animating it. If the current child is the first one, the last child shown.
*/
public void showPreviousChild() ;

/**
* Sets the target child as the visible one. Can be animated or not. When animated, it animates from the current visible child immediately to the target one.
*
* @param targetChild - the target child
* @param animate - flag to make the transition animating it or not
*/
public void showChild(int targetChild, boolean animate)
```

Examples (click image to expand code)


Use to simply flip one view with another

```xml

```

OR


Use to swap over several views

```xml

```

***

Customization

| Attribute |Type | Description | Default |
|---|---|---|---|
| startingChild | int | First visible child| 0 |
| transitionDuration | int | The ending angle for button disposition | 200 |
| transition | enum | The type of the transition, one of: FADE, FLIP_X, FLIP_Y, TRANSLATE_X, TRANSLATE_Y, FLIP_Z1, FLIP_Z2 | FLIP_Y |