I have a Cardview with height WRAP_CONTENT . Content of Cardview is to be populated after network call . And based on the height of Cardview I have to set background in my fragment . So I tried using ViewTreeObserver and Post method but I am still getting value as 0.
cardTierInfo.post {
cardTierInfoHeight = cardTierInfo.height
setLayoutParams(cardTierInfoHeight)
}
Call is being made in OncreateView.
If you using kotlin extends
core-ktxit is easy to get actual height bydoOnLayout