skydoves / ExpandableLayout

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

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

Open IstrateAndrei opened 3 years ago

IstrateAndrei commented 3 years ago

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 commented 3 years ago

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

sartajroshan commented 3 years ago

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 commented 3 years ago

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

DatL4g commented 3 years ago

@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 commented 2 years ago

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:

*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 commented 2 years ago

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 commented 2 years ago

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