GithubHelp home page GithubHelp logo

leestars / expandablelayout Goto Github PK

View Code? Open in Web Editor NEW

This project forked from traex/expandablelayout

0.0 2.0 0.0 723 KB

Implementation of ExpandableListview with custom header and custom content.

License: MIT License

Java 100.00%

expandablelayout's Introduction

ExpandableLayout

ExpandableLayout

ExpandableLayout provides an easy way to create a view called header with an expandable view. Both view are external layout to allow a maximum of customization. You can find a sample that how to use an ExpandableLayout to your layout.

ExpandableLayout GIF

Integration

The lib is available on Maven Central, you can find it with Gradle, please

dependencies {
    compile 'com.github.traex.expandablelayout:library:1.2.2'
}

Usage

ExpandableLayout

Declare an ExpandableLayout inside your XML layout file. You also need to other layouts for header and content:

  <com.andexert.expandablelayout.library.ExpandableLayout
         android:id="@+id/expandableLayout"
         xmlns:expandable="http://schemas.android.com/apk/res-auto"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         expandable:headerLayout="@layout/view_header"
         expandable:contentLayout="@layout/view_content"/>
         

ExpandableLayoutItem && ExpandableLayoutItem

You can use ExapandableLayout in an ExpandableLayoutListView with ExpandableLayoutItem as row :

ExpandableLayoutItem

  <com.andexert.expandablelayout.library.ExpandableLayoutItem
         android:id="@+id/expandableLayout"
         xmlns:expandable="http://schemas.android.com/apk/res-auto"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         expandable:headerLayout="@layout/view_header"
         expandable:contentLayout="@layout/view_content"/>
         

ExpandableLayoutListView

  <com.andexert.expandablelayout.library.ExpandableLayoutListView
         android:id="@+id/expandableLayout"
         xmlns:expandable="http://schemas.android.com/apk/res-auto"
         android:layout_width="match_parent"
         android:layout_height="match_parent"/>
         

If you want to manage the OnScroll, you have to use OnExpandableLayoutScrollListener and don't forget to call super in each method.

You can call dynamically open, close and isOpened from an ExpandableLayout object.

Customization

You can change duration of the animation:

  • app:duration [integer def:200] --> Duration of the animation

Troubleshooting

If you want to use the ExpandableLayoutListView with EditText, you have to set android:windowSoftInputMode="adjustPan" to prevent the ListView to redraw itself and close the ExpandableLayoutItem.

Acknowledgements

Thanks to Google for its ExpandableListview :)

MIT License

    The MIT License (MIT)
    
    Copyright (c) 2014 Robin Chutaux
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.

expandablelayout's People

Contributors

traex avatar dinosoeren avatar

Watchers

James Cloos avatar leestarts avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.