ExpandableLayout icon indicating copy to clipboard operation
ExpandableLayout copied to clipboard

Fixed height, not able to see the full view.

Open IstrateAndrei opened this issue 3 years ago • 7 comments

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

IstrateAndrei avatar Mar 16 '21 07:03 IstrateAndrei

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

skydoves avatar May 12 '21 14:05 skydoves

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

sartajroshan avatar Jun 26 '21 06:06 sartajroshan

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

@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)}"
    }
}

DatL4g avatar Aug 08 '21 02:08 DatL4g

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

abedsako avatar Sep 28 '21 06:09 abedsako

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

jdsdhp avatar Apr 03 '22 01:04 jdsdhp

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

sOlnblshkO avatar Sep 13 '22 09:09 sOlnblshkO