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.Alignment
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 - Column Center",
color = Color.White)},
backgroundColor = Color(0xFF333399)) },
content = {MainContent()},
backgroundColor = Color(0xFFEDEAE0)
)
}
@Composable
fun MainContent(){
Column(
Modifier
.background(Color(0xFFF19CBB))
.fillMaxWidth()
.height(350.dp)
.padding(8.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
){
Text("Column Center")
}
}
@Preview
@Composable
fun ComposablePreview(){
//GetScaffold()
}
}
- jetpack compose - Text custom font
- jetpack compose - LazyColumn scroll to top bottom
- jetpack compose - LazyColumn smooth scrolling
- jetpack compose - Infinite float animation
- jetpack compose - Animation start delay
- jetpack compose - Double tap listener
- jetpack compose - Long press listener
- jetpack compose - Button elevation
- jetpack compose - TextField request focus
- jetpack compose - Box alignment
- jetpack compose - Box elevation
- jetpack compose - Box vs Surface
- jetpack compose - Column background color
- jetpack compose - Column border
- jetpack compose - Column spacing