Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Height spacer (HeightSpacer) in Jetpack Compose

I'm trying this tutorial from https://developer.android.com. image for code But I can't import HeightSpacer. Is HeightSpacer deprecated? I can't find any new alternatives for that? Thank you.

like image 688
Thaw De Zin Avatar asked Feb 10 '20 07:02

Thaw De Zin


People also ask

What is spacer in jetpack compose?

In Jetpack Compose, a Spacer is a blank element that is used to create a Space between two UI elements.

What is scaffold in jetpack compose?

Scaffold provides a slot for a floating action button. You can use the floatingActionButton slot and a FloatingActionButton : Scaffold( floatingActionButton = { FloatingActionButton(onClick = { /* ...

How does a jetpack work internally?

Jetpack Compose is a modern declarative UI Toolkit for Android. Compose makes it easier to write and maintain your app UI by providing a declarative API that allows you to render your app UI without imperatively mutating frontend views.


1 Answers

You can use a Spacer with a height modifier—or any other modifier(s) that you like. For example:

Spacer(modifier = Modifier.height(16.dp))
like image 184
Ryan M Avatar answered Oct 05 '22 22:10

Ryan M