Introduction

A togglelayout that can be used in setting interface

Informations

Creator
fenjuly
fenjuly
Git URL:
Language
Java
Min SDK:
Android 4.1
License:
The MIT License
Created At:
Aug 30, 2015
Last Updated:
Dec 07, 2017
Star:
776
Fork:
137
Watcher count:
23
Tags

Description

ToggleExpandLayout

Android Arsenal

A togglelayout that can be used in setting interface. Originally designed by dribbble. And the author said that's why he designed this:

I never liked how some settings are disabled by default and not tappable until another settings has been turned on/off.

My concept is to hide these disabled settings behind their "master toggle" and then have them transition out as they become active - making the list cleaner, with less clutter and ultimately easier to use.

Preview

toggleexpandlayout

Usage

  • XML
if yout just use one togglelayout:

 <com.fenjuly.mylibrary.ToggleExpandLayout
        android:id="@+id/toogleLayout"
        android:layout_marginTop="15dp"
        android:layout_marginLeft="15dp"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >


    &lt;View
        android:id="@+id/view1"
        android:layout_width="300dp"
        android:layout_height="80dp"
        android:background="#ffffff"
        android:elevation="2dp"
        android:outlineProvider="bounds"
        &gt;
    &lt;/View&gt;
    &lt;View
        android:id="@+id/rootView"
        android:layout_width="300dp"
        android:layout_height="80dp"
        android:background="#ffffff"
        android:elevation="2dp"
        android:outlineProvider="bounds"
        &gt;
    &lt;/View&gt;
&lt;/com.fenjuly.mylibrary.ToggleExpandLayout&gt;

if yout want to use more than one togglelayouts with drop and rise animation, use DropDownLayout:

 <com.fenjuly.mylibrary.DropDownLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="15dp"
        android:layout_marginLeft="15dp"
        >


&lt;com.fenjuly.mylibrary.ToggleExpandLayout
    android:id="@+id/toogleLayout"
    android:layout_marginTop="15dp"
    android:layout_marginLeft="15dp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    &gt;
    ...
&lt;/com.fenjuly.mylibrary.ToggleExpandLayout&gt;

&lt;com.fenjuly.mylibrary.ToggleExpandLayout
    android:id="@+id/toogleLayout"
    android:layout_marginTop="15dp"
    android:layout_marginLeft="15dp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    &gt;
    ...
&lt;/com.fenjuly.mylibrary.ToggleExpandLayout&gt;
&lt;/com.fenjuly.mylibrary.DropDownLayout&gt;

  • JAVA
two methods public void open() and public void close()

layout.setOnToggleTouchListener(new ToggleExpandLayout.OnToggleTouchListener() {
            @Override
            public void onStartOpen() {
            }


        @Override
        public void onOpen() {
        }

        @Override
        public void onStartClose() {
        }

        @Override
        public void onClosed() {
        }
    });

Get into your build

repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
    compile 'com.github.fenjuly:ToggleExpandLayout:774e497692'
}

License

MIT

Discussion