MainActivity.kt
package com.cfsuman.jetpackcompose
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
GetScaffold()
}
}
@Composable
fun GetScaffold(){
Scaffold(
topBar = {TopAppBar(
title = {Text(
"Compose - Row Space Between",
color = Color.White)},
backgroundColor = Color(0xFF58427C)) },
content = {MainContent()},
backgroundColor = Color(0xFFEDEAE0)
)
}
@Composable
fun MainContent(){
Row(
modifier = Modifier
.fillMaxWidth()
.height(200.dp)
.padding(12.dp),
horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
Box(
Modifier
.fillMaxSize()
.weight(1f)
.background(Color(0xFF89CFF0))
)
Box(
Modifier
.fillMaxSize()
.weight(1f)
.background(Color(0xFFFF91AF))
)
Box(
Modifier
.fillMaxSize()
.weight(1f)
.background(Color(0xFFFE6F5E))
)
}
}
@Preview
@Composable
fun ComposablePreview(){
//GetScaffold()
}
}
- jetpack compose - Column weight
- jetpack compose - Row center vertically
- jetpack compose - Row align end
- jetpack compose - Row gravity
- jetpack compose - Row background
- jetpack compose - Row alignment
- jetpack compose - Row overflow
- jetpack compose - Dismiss Snackbar programmatically
- jetpack compose - Snackbar host state
- jetpack compose - Scaffold Snackbar host
- jetpack compose - AndroidView click event
- jetpack compose - AndroidView modifier
- jetpack compose - How to use bottom navigation
- jetpack compose - Navigation arguments data type
- jetpack compose - Navigation object argument