Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExpandableLinearLayout not animating vertically even if app:ael_orientation = "vertical" #79

Open
azizkayumov opened this issue Jul 4, 2016 · 6 comments

Comments

@azizkayumov
Copy link

azizkayumov commented Jul 4, 2016

Here is my xml:

`

<com.github.aakira.expandablelayout.ExpandableLinearLayout
    android:id="@+id/expandableLayout"
    android:layout_width="match_parent"
    android:layout_below="@+id/overlayText"
    android:layout_height="wrap_content"
    android:background="@color/colorAccent"
    app:ael_expanded="false"
    app:ael_duration="300"
    app:ael_interpolator="fastOutSlowIn"
    app:ael_orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:minHeight="206dp"
        android:layout_height="wrap_content"/>

</com.github.aakira.expandablelayout.ExpandableLinearLayout>

`

And this is my fragment code snippet:

`mExpandLayout = (ExpandableLinearLayout) root.findViewById(R.id.expandableLayout);
mOverlayText = (TextView) root.findViewById(R.id.overlayText);

    mOverlayText.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mExpandLayout.toggle();
        }
    });`

I should use ExpandableLinearLayout since the child will chage its size. Please, help!

@mojotti
Copy link

mojotti commented Jul 8, 2016

I'm having exactly the same problem!

@mojotti
Copy link

mojotti commented Jul 10, 2016

Hello AbduazizKayumov,

I managed to find a solution for this problem. I have also text that is coming from server so it will change it's size dynamically.

You have to use ExpandableRelativeLayout like this:

    <Button
        android:id="@+id/expandableButton1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/dark_green2"
        android:drawableRight="@android:drawable/arrow_down_float"
        android:onClick="expandableButton1"
        android:text=""
        android:textColor="#fff"
        android:layout_marginTop="16dp"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:visibility="gone" />

    <com.github.aakira.expandablelayout.ExpandableRelativeLayout
        android:id="@+id/expandableLayout1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/light_green2"
        android:padding="16dp"
        app:ael_duration="400"
        app:ael_expanded="true"
        app:ael_interpolator="bounce"
        app:ael_orientation="vertical"
        android:layout_below="@+id/expandableButton1"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:visibility="gone">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/expandableText1"
            android:text="Loading stuff from internet..."/>
    </com.github.aakira.expandablelayout.ExpandableRelativeLayout>

Note here that I use: android:visibility="gone" by default. This makes view invisible at first. We will make it visible on Java code.

Then on Java code, add function like this, before you call your mOverlayText.setOnClickListener(new View.OnClickListener()

public void makeViewsVisible() {
View view1 = findViewById(R.id.expandableButton1);
View view1_text = findViewById(R.id.expandableLayout1);

view1.setVisibility(View.VISIBLE);
view1_text.setVisibility(View.VISIBLE);

}

You have to also call this function from inside your mOverlayText.setOnClickListener(new View.OnClickListener().

For me it works, does not matter that I have text coming from server. Also there is no problem with animation.

Hope this helps!

@dude0367
Copy link

I had the same issue, the that I found is to use
android:orientation="vertical"
as an attribute because it extends LinearLayout. Enjoy.

@aplocher
Copy link

@dude0367 your solution fixed it for me. I have both ael_orientation=vertical and android:orientation='vertical' and it works now. Thanks

@sankar07
Copy link

ael_orientation=vertical and android:orientation='vertical' and it works now. Thanks

@kirtanparmar
Copy link

kirtanparmar commented Apr 19, 2020

I had the same issue, the that I found is to use
android:orientation="vertical"
as an attribute because it extends LinearLayout. Enjoy.

Not working for me.

@dude0367 your solution fixed it for me. I have both ael_orientation=vertical and android:orientation='vertical' and it works now. Thanks

With this works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants