diegodobelo / AndroidExpandingViewLibrary

This is a library to help creating expanding views with animation in Android
942 stars 120 forks source link

Change layout seperator when item expand #9

Open nguyencongbinh opened 7 years ago

nguyencongbinh commented 7 years ago

The expanding layout.xml

<?xml version="1.0" encoding="utf-8"?>
<com.diegodobelo.expandingview.ExpandingItem
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:item_layout="@layout/expanding_item"
    app:sub_item_layout="@layout/expanding_sub_item"
    **app:separator_layout="@layout/item_separate**"
    app:show_animation="true"
    app:start_collapsed="true"
    app:animation_duration="250"/>

item_separate layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_marginBottom="20dp"
        android:layout_marginTop="20dp"
        android:background="@color/white_opacity_35" />

</LinearLayout>

Now, I want to change the layout separate when an item expands but I can't find the method to do this. Please help. Thanks.

diegodobelo commented 7 years ago

Hi @nguyencongbinh , sorry for the delay to answer. Unfortunately it is not possible to change the separator layout in runtime using this library. Too much changes are required in the code to make it work as you suggested. I'll take this as a suggestion for the next library version. Sorry for the inconvenience.