Skip to content Skip to sidebar Skip to footer

What's The Deal With Expandablelistviews?

So I want to create an Expandable List View and every place I look, it seems like they are programming in their own functionality for the Expandable List View themselves. Do you r

Solution 1:

So I have used this library to achieve the expansion and collapse behavior and it works like a charm.

<com.github.florent37.expansionpanel.ExpansionHeaderandroid:layout_height="wrap_content"android:layout_width="match_parent"app:expansion_headerIndicator="@id/headerIndicator"app:expansion_layout="@id/expansionLayout"app:expansion_toggleOnClick="true"><!-- HEADER -->

    ...
    <!-- HEADER INDICATOR --><ImageViewandroid:adjustViewBounds="true"android:id="@+id/headerIndicator"android:layout_gravity="center_vertical|right"android:layout_height="wrap_content"android:layout_marginLeft="16dp"android:layout_width="wrap_content"app:srcCompat="@drawable/ic_expansion_header_indicator_grey_24dp" /></com.github.florent37.expansionpanel.ExpansionHeader><com.github.florent37.expansionpanel.ExpansionLayoutandroid:id="@+id/expansionLayout"android:layout_height="wrap_content"android:layout_width="match_parent"><!-- CONTENT --></com.github.florent37.expansionpanel.ExpansionLayout>

Attach a listener in Activity like this

ExpansionLayoutexpansionLayout= findViewById(...);
expansionLayout.addListener(newExpansionLayout.Listener() {
    @OverridepublicvoidonExpansionChanged(ExpansionLayout expansionLayout, boolean expanded) {

    }
});

Post a Comment for "What's The Deal With Expandablelistviews?"