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

Fixed height, not able to see the full view. #23

Open
IstrateAndrei opened this issue Mar 16, 2021 · 7 comments
Open

Fixed height, not able to see the full view. #23

IstrateAndrei opened this issue Mar 16, 2021 · 7 comments

Comments

@IstrateAndrei
Copy link

Library Version v1.0.6

The layout set as secondLayout is not displayed entirely. It has android:layout_height="match_parent" but the ExpandableLayout doesn't take in the full size of the layout file.

I'd expect to have the second layout fully displayed. The ExpandableLayout should take the added height of it's parent and second layout when expanded. Right now I see it's a fixed size and I have to include a ScrollView as a workaround

@skydoves
Copy link
Owner

Hi, a new version 1.0.7 has been released.
Please try using a new release. Thanks!

@sartajroshan
Copy link

sartajroshan commented Jun 26, 2021

Hi, a new version 1.0.7 has been released.
Please try using a new release. Thanks!

I faced this issue in version 1.0.7. When using recyelerView in secondLayout

@mariofelesdossantosjunior

I'm having the same problem, is there any solution?

@DatL4g
Copy link

DatL4g commented Aug 8, 2021

@skydoves This is still a problem.
I tried to fix this and just couldn't find the reason why it works in your demo but not in my app.
I discoverd that this is caused when the layout height is changed because it's content changed.

To reproduce this just adjust this line in your demo MainActivity to change the text and make it larger dynamically:

expandable1.setOnExpandListener {
    if (it) {
        toast("expanded")
        expandable1.secondLayout.findViewById<TextView>(R.id.textView).text = "${getString(R.string.text_stars)}${getString(R.string.text_stars)}${getString(R.string.text_stars)}"
    } else {
        toast("collapse")
        expandable1.secondLayout.findViewById<TextView>(R.id.textView).text = "${getString(R.string.text_stars)}${getString(R.string.text_stars)}${getString(R.string.text_stars)}"
    }
}

@abedsako
Copy link

I faced this issue the same issue.
after the Expandable layout is created and I set the text to the text view in the (second layout) is not displayed entirely,
I needed to find a quick fix so I have done the following:

  • Removed (app:expandable_secondLayout="@layout/expandable_second") from the XML layout.
  • Pass the (second layout) right before setting the text to its component
    (binding.myExpandableLayout.secondLayoutResource = R.layout.expandable_second)
  • Set the data (binding.myExpandableLayout.secondLayout.findViewById<TextView>(R.id.expandableDescription).text = longDescription)

*Note: if there is an image view with an image in it or a text view with text in it in the XML layouts it will redraw above it again

@jdsdhp
Copy link

jdsdhp commented Apr 3, 2022

Hi, a new version 1.0.7 has been released.
Please try using a new release. Thanks!

I faced this issue in version 1.0.7. When using recyelerView in secondLayout

I'm having the same problem using 1.0.7 version

@sOlnblshkO
Copy link

I faced this issue the same issue. after the Expandable layout is created and I set the text to the text view in the (second layout) is not displayed entirely, I needed to find a quick fix so I have done the following:

  • Removed (app:expandable_secondLayout="@layout/expandable_second") from the XML layout.
  • Pass the (second layout) right before setting the text to its component
    (binding.myExpandableLayout.secondLayoutResource = R.layout.expandable_second)
  • Set the data (binding.myExpandableLayout.secondLayout.findViewById<TextView>(R.id.expandableDescription).text = longDescription)

*Note: if there is an image view with an image in it or a text view with text in it in the XML layouts it will redraw above it again

OH MY ***ING LIFE. THANKS A LOT.
I have faced same issue, but i was summarize all textview lines and multiplied it on some constant and after this reindicated layoutParams for secondLayout and it some how a little bit fixed my issues!
Thank you @abedsako

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

8 participants