traex / ExpandableLayout

Implementation of ExpandableListview with custom header and custom content.
MIT License
1.64k stars 361 forks source link

java.lang.IllegalArgumentException: HeaderLayout and ContentLayout cannot be null! #26

Open Abhiseshan opened 9 years ago

Abhiseshan commented 9 years ago

java.lang.IllegalArgumentException: HeaderLayout and ContentLayout cannot be null!

I have tried everything. Even copying the whole code.

        <com.andexert.expandablelayout.library.ExpandableLayout
            android:id="@+id/expandableGraph"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            expandable:el_headerLayout="@layout/view_header"
            expandable:el_contentLayout="@layout/view_content"
            android:background="#e74c3c"/>
VeeruPV commented 9 years ago

Had the same problem too - not sure what is wrong. The only thing that worked for me was to use the source directly rather than gradle.

ponnamkarthik commented 7 years ago

Try changing this

expandable:el_headerLayout="@layout/view_header" expandable:el_contentLayout="@layout/view_content"

to

app:el_headerLayout="@layout/view_header" app:el_contentLayout="@layout/view_content"

flaviosuardi commented 7 years ago

I fix by adding this declaration in project attrs.xml file:

<declare-styleable name="ExpandableLayout">
        <attr name="headerLayout" format="reference"/>
        <attr name="contentLayout" format="reference" />
        <attr name="duration" format="integer" />
</declare-styleable>

You can see I renamed the attributes name so in fragment xml file you can use expandable namespace with attributes headerLayout and contentLayout like this:

<com.andexert.expandablelayout.library.ExpandableLayout
        android:id="@+id/first"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        expandable:headerLayout="@layout/layout_accordion_header"
        expandable:contentLayout="@layout/layout_accordion_content"
        android:background="#e74c3c"/>