skydoves / ExpandableLayout

🦚 An expandable layout that shows a two-level layout with an indicator.
Apache License 2.0
833 stars 54 forks source link

Wrong header size #19

Closed IgnacioBasallote closed 3 years ago

IgnacioBasallote commented 3 years ago

Please complete the following information:

Describe the Bug: Hi,

I am having some troubles while displaying the parent layout. It seems to have a fixed size and it does not adapts to the actual size of my parent layout. The Expandable layout is wrapped within a linearlayout in a nestedscroll view.

I attach the code in case I am doing something wrong:

<com.skydoves.expandablelayout.ExpandableLayout
                android:id="@+id/expandableThirdPartyDevices"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="15dp"
                app:expandable_duration="300"
                app:expandable_isExpanded="false"
                app:expandable_parentLayout="@layout/content_expandable_parent"
                app:expandable_secondLayout="@layout/content_expandable_second"
                app:expandable_showSpinner="true"
                app:expandable_spinner="@drawable/ic_arrow_down"
                app:expandable_spinner_animate="true"
                app:expandable_spinner_margin="14dp"
                app:expandable_spinner_gravity="end"
                app:expandable_spinner_size="32dp" />`

content_expandable_parent:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    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="40dp"
    android:background="@drawable/rounded_corners_button"
    android:backgroundTint="@color/StemyEnergy.Color.UI.Text.Background.Blue"
    android:id="@+id/ctlySelectDevice">

    <TextView
        android:id="@+id/txtSelectDevice"
        android:textSize="@dimen/medium_text_size_app"
        android:textColor="@color/StemyEnergy.Color.UI.Text.Blue"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingStart="15dp"
        android:gravity="start|center"
        android:text="@string/StemyEnergy.String.UI.GeneralMessages.TestText"
        />
</LinearLayout>

Expected Behavior: What I expect is the expandable layout header to adapt to my parent layout content.

Thanks in advance for your help!!

Cheers, Nacho

IgnacioBasallote commented 3 years ago

Hi,

It seems that the header lauoyt must be wrapped within a RelativeLayout. By doing this, the problem is solved.

Cheers,