Implementation of ExpandableListview with custom header and custom content.

Overview

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.
Comments
  • name headerLayout is generic and may conflict with navigation drawer implementation

    name headerLayout is generic and may conflict with navigation drawer implementation

    at least a few people have had the issue where they use a headerLayout as the name for the navigation drawer header layout, which causes generated build files to have conflicts here is one other example on stackoverflow I would suggest changing the name to something like fixedHeaderLayout for example

    opened by swolfand 7
  • Update ExpandableLayout.java

    Update ExpandableLayout.java

    Added ability to implement AnimationListener. This allows use of onAnimationStart() and onAnimationEnd() to accomplish certain tasks at a desired point in time.

    opened by DinoSoeren 3
  •  Attribute

    Attribute "headerLayout" has already been defined

    ...app/build/intermediates/exploded-aar/com.viewpagerindicator/library/2.4.1/res/values/values.xml
    Attribute "headerLayout" has already been defined
    

    How to overcome this. I think another library also has "headerLayout" attribute

    opened by jemshit 2
  • java.lang.NullPointerException

    java.lang.NullPointerException

    java.lang.NullPointerException at com.andexert.expandablelayout.library.ExpandableLayoutListView.performItemClick(ExpandableLayoutListView.java:65) at android.widget.AbsListView$PerformClick.run(AbsListView.java:2749)

    if you add more items,for example,ten or twenty so that listview will hide some items,the bug will reappear.

    ExpandableLayoutItem expandableLayout = (ExpandableLayoutItem) getChildAt(position).findViewWithTag(ExpandableLayoutItem.class.getName());
    if (expandableLayout.isOpened()) {
        expandableLayout.hide();
    } else {
    expandableLayout.show();
    }
    
    opened by Haoxiqiang 1
  • added listener for events.

    added listener for events.

    I added code for observations.

    Some times, I need handling start and end of animations.

    Listener is used above.

        private ExpandableLayout expandableLayout;
    
        expandableLayout.setOnStartHidingListener(new ExpandableLayout.OnStartHidingListener() {
            @Override
            public void onHidingowing(ExpandableLayout layout) {
    
            }
        });
    
        expandableLayout.setOnStartShowingListener(new ExpandableLayout.OnStartShowingListener() {
            @Override
            public void onStartShowing(ExpandableLayout layout) {
    
            }
        });
    
        expandableLayout.setOnFinishHidingListener(new ExpandableLayout.OnFinishHidingListener() {
            @Override
            public void onFinishHiding(ExpandableLayout layout) {
    
            }
        });
    
        expandableLayout.setOnFinishShowingListener(new ExpandableLayout.OnFinishShowingListener() {
            @Override
            public void onFinishShowing(ExpandableLayout layout) {
    
            }
        });
    
    opened by garam-park 0
  • Typo and grammatical errors

    Typo and grammatical errors

    In the first paragraph, below the first picture diagram, the line is written as, " Both view are external layout to allow a maximum of customization." This line has some errors. The correct line could be, " Both views have an external layout to allow maximum customization.

    In the usage section, in the ExpandableLayout subheading, the line is written as, "You also need to other layouts for header and content:" The corrected line could be written as, " You also need other layouts for header and content:"

    Thank you.

    opened by RealWorldEdits376W 0
  • Typo and grammatical errors

    Typo and grammatical errors

    In the first paragraph, below the first picture diagram, the line is written as, " Both view are external layout to allow a maximum of customization." This line has some errors. The correct line could be, " Both views have an external layout to allow maximum customization.

    In the usage section, in the ExpandableLayout subheading, the line is written as, "You also need to other layouts for header and content:" The corrected line could be written as, " You also need other layouts for header and content:"

    Thank you.

    opened by RealWorldEdits376W 0
  •  android.view.InflateException: Binary XML file line #0

    android.view.InflateException: Binary XML file line #0

    I am getting this weird error while integrating your library in my app! I don't know why and I need your help urgently?

    Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.andexert.expandablelayout.library.ExpandableLayout Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.andexert.expandablelayout.library.ExpandableLayout Caused by: @java.lang.reflect.InvocationTargetException

    opened by MohamedHashim 3
Owner
Robin Chutaux
Robin Chutaux
Linear layout, that wrap its content to the next line if there is no space in the current line.

Android flow layout Introduction Extended linear layout that wrap its content when there is no place in the current line. [] (https://travis-ci.org/Ap

Artem.Votincev 2k Jan 5, 2023
NodeFlow is a library that makes visualizing hierarchical content easier.

NodeFlow NodeFlow is an Android library that provides a simple way to visualize hierarchical content. Perfect for displaying items that are organized

Telenav Inc 546 Dec 7, 2021
:octocat: 📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion

FOLDING CELL [JAVA] Expanding content cell with animation inspired by folding paper card material design. We specialize in the designing and coding of

Ramotion 4.9k Dec 7, 2022
An Android demo of a foldable layout implementation. Engineered by Vincent Brison.

Foldable Layout This code is a showcase of a foldable animation I created for Worldline. The code is fully written with java APIs from the Android SDK

Worldline 599 Dec 23, 2022
An implementation of tap targets from the Material Design guidelines for feature discovery.

TapTargetView An implementation of tap targets from Google's Material Design guidelines on feature discovery. Min SDK: 14 JavaDoc Installation TapTar

Keepsafe 5.2k Jan 9, 2023
Android implementation of FlowLayout. Layout arranges its children in multiple rows depending on their width.

FlowLayout FlowLayout is an opensource Android library that alows developers to easily integrate flow layout into their app. FlowLayout is an layout t

Blaž Šolar 754 Dec 15, 2022
A backwards compatible implementation of GridLayout for Android

GridLayout Library This library provides a version of GridLayout that works across all versions of Android 1.5+. As a side effect, this library also i

Daniel Lew 186 Nov 25, 2022
null 2.4k Dec 30, 2022
a custom pull-to-refresh layout which contains a interesting animation

This is a project with custom pull-to-refresh layout which contains a interesting animation. And the animation is inspired by https://dribbble.com/sho

ZhangLei 1.8k Dec 27, 2022
GoolgePlusLayout is a custom layout that plays animation on the children views while scrolling as the layout in the Google Plus (android) main page

Google Plus Layout Google Plus Layout is a custom layout that support playing animation on child view(s) in a serialize manner like the the main

Ahmed Nammari 224 Nov 25, 2022
A custom ViewPager title strip which gives continuous feedback to the user when scrolling

SmartTabLayout A custom ViewPager title strip which gives continuous feedback to the user when scrolling. This library has been added some features an

ogaclejapan 7k Jan 7, 2023
A custom SwipeRefreshLayout to support the pull-to-refresh featrue.RecyclerView,ListView,GridView,NestedScrollView,ScrollView are supported.

SuperSwipeRefreshLayout A custom SwipeRefreshLayout to support the pull-to-refresh featrue.You can custom your header view and footer view. RecyclerVi

Zheng Haibo(莫川) 1.3k Dec 13, 2022
CircularStats - Custom Widget to display stats of any thing

CircularStats This is a custom widget made with Jetpack Compose for displaying s

null 14 Jul 2, 2022
FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

null 33 Dec 8, 2022
TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.

This project isn't maintained anymore. It is now recommended to use https://github.com/peterLaurence/MapView. MapView is maintained by Peter, one of o

Mike Dunn 1.5k Nov 21, 2022
[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly

ShowcaseView The ShowcaseView (SCV) library is designed to highlight and showcase specific parts of apps to the user with a distinctive and attractive

Alex Curran 5.6k Dec 16, 2022
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Umano: News Read To You 9.4k Dec 31, 2022
VoronoiView is a view (ViewGroup) that allows you to add and display views inside Voronoi diagram regions.

Vorolay VoronoiView is a view (ViewGroup) that allows you to add and display views inside Voronoi diagram regions. [Voronoi diagram] (https://en.wikip

Daniil Jurjev 918 Dec 4, 2022
Navigation Drawer Activity with material design style and simplified methods

MaterialNavigationDrawer Navigation Drawer Activity with material design style and simplified methods       It requires 10+ API and android support v7

Fabio Biola 1.6k Dec 30, 2022