Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/cmfsotelo/FlipLayout
- Owner: cmfsotelo
- License: apache-2.0
- Created: 2017-05-12T10:42:06.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-16T22:59:04.000Z (almost 7 years ago)
- Last Synced: 2024-08-02T01:25:34.939Z (7 months ago)
- Language: Java
- Size: 591 KB
- Stars: 46
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-android-ui - FlipLayout - 容易的对ViewGroup的子View进行交换 (其他)
README
# FlipLayout
[](https://jitpack.io/#cmfsotelo/fliplayout)

[](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 |