https://kotlinlang.org logo
#compose
Title
# compose
k

KotlinLeaner

02/16/2023, 11:31 AM
Hi, In xml we use
View.INVISIBLE
to just don't show the view at all, but it still takes up space for layout purposes. What is the alternative in jetpack compose?
Copy code
AnimatedVisibility(
    // true or false
) {
    Button() // button code.
}
j

Jonas

02/16/2023, 11:53 AM
First thing that comes to my mind is using the
graphicsLayer
modifier with alpha 0.
s

Stylianos Gakis

02/16/2023, 12:21 PM
Altering only the graphicsLayer alpha may mean that it’s still interactable and does stuff though right? It may not be what you want in some cases, to be careful to also disable such touch inputs.
k

KotlinLeaner

02/16/2023, 12:22 PM
Sure, I'll take care of that. Thanks for gudiance
s

Sean Proctor

02/16/2023, 2:03 PM
Depends what you're trying to do. Placeholder from accompanist might be what you want https://github.com/google/accompanist
k

KotlinLeaner

02/16/2023, 2:21 PM
@Sean Proctor what should I use with accompanist ?
s

Sean Proctor

02/16/2023, 2:44 PM
Placeholder
9 Views